Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Cumulative network traffic

Cumulative network traffic

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 16.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    J
    Marco Incalcaterra
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • J
        J
        Marco Incalcaterra
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • V
          V
          Victor Kirhenshtein
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0

          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
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups