Cumulative network traffic
-
I grab the Victor's suggestion present in this post:
https://www.netxms.org/forum/general-support/summary-of-network-traffic-1387/msg6048/#msg6048
And I wrote my transformation for the Internal DCI in this way (keeping the original value):
sub getValue(paramDescr) { obj = FindDCIByDescription($node, paramDescr); if (obj != null) { dci = GetDCIObject($node, obj); if (dci != null && dci->status == 0 && dci->errorCount == 0) { val = GetDCIValue($node, dci->id); if (val != null) return val; } } return 0; } return $1+getValue("_HF - Download on eth0 (bytes)");My problem is that I'm getting exactly the value of the original DCI ("_HF - Download on eth0 (bytes)"). Where am I wrong?
Do you have a suggestion on how to reset the counter once per month still mantaining an history (even in another DCI)? The goal is to obtain network traffic statistics per each month.
Best regards,
Marco -
You returning value of original DCI in your transformation script, but if you want cumulative counter, you should return sum of current value of your dummy DCI and current value of original DCI, something like
GetDCIValue($node, dci->id) + GetDCIValue($node, $dci->id)
($dci refers to current DCI being processed).
And to reset the counter - check if last poll time for your dummy DCI is in different month, and return 0 in that case, like this:
if (strftime("%m", $dci->lastPollTime) < strftime("%m", time()))
return 0;Best regards,
Victor -
Hi Victor,
it works, thank you for your help. Do you have a suggestion on how to store cumulative values month by month (e.g. traffic for january, february, etc.)?
I have a suggestion for the transformation editor: add the line numbers, if the script is long it is difficult to reach the line indicated by the error message without manually counting the lines.
Best regards,
Marco -
Hi!
You can create new internal DCI with custom schedule to run once per month and either read current value of cumulative counter in transformation script. The tricky part is timing to ensure that monthly DCI runs before cumulative counter resets at month change. Alternative option could be storing value temporarily in node's custom parameters - when cumulative counter resets, it stores it's current value into some custom attribute, and then monthly DCI reads it.
Best regards,
Victor
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login