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. Can't get a solution with automatic PushAgent increase

Can't get a solution with automatic PushAgent increase

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 40.8k 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.
  • G
    G
    gannet
    wrote on last edited by
    #1

    Hello! I'm trying to get cumulative metrics by tracking daily renewing one. So every increase of a daily metric raises an event. Then this increase must be appended to cumulative metric's meaning and ... I just can't give arguments to adding script. I checked:

    1. script is working with arguments in server console and works with defined one
    2. arguments are right because email action can recognize them
    3. selecting Run NXSL Script give has no result in case of arguments addition to script name even if the last one does not use arguments at all. I'm very sad...
    4. any walked roundabout way of script execution doesn't work
    5. I haven't found a way to get current value of PushAgent characteristics from .bat command file
    6. script can't get any object reference another way but arguments OR may be I'm wrong?

    obj = FindObject($1); //get object
    cur = GetDCIValue(obj, FindDCIByName(obj, "TotalCount")); //get current value
    if (cur == null)
        cur = 0;
    PushDCIData(obj, FindDCIByName(obj, "TotalCount"), cur + $2); //increase it

     
    Can you suggest any way to push increase of cumulative metric, please? I have no right ideas

    1 Reply Last reply
    0
    • T
      T
      Tursiops
      wrote on last edited by
      #2

      Not sure how your original daily metric is done exactly, but if the idea is to update the Push DCI every time the daily one is polled, you can add your code into the daily DCI's transformation script directly.

      dci=FindDCIByName($node,"TotalCount");
      cur=GetDCIValue($node,dci);
      if (cur == null ) cur=0;
      PushDCIData($node,dci,cur+$1);
      return $1;
      

      This will get the Push DCI object, get its current value, set to 0 if null, then push the data from the DCI that's actually been polled and add it to the Push DCI.
      The script will run every time the original DCI is polled. No event, action, separate script, etc. required.
      You may want to add some logic to ensure $1 (i.e. the value of the original DCI) is actually an integer/float before you do the addition.
      You could also add code to create the PushDCI itself if it doesn't exist yet.

      1 Reply Last reply
      0
      • G
        G
        gannet
        wrote on last edited by
        #3

        Thank You Tursiops!
        Your solution is obviously logical and simple instead of my search for a roundabout way. By using simple difference value I get this:

        if ($1 != 0){
            dci=FindDCIByName($node,"TotalCount");
            cur=GetDCIValue($node,dci);
            if (cur == null ) cur=0;
            PushDCIData($node,dci,cur+$1);
        }
        return GetDCIValue($node,$dci->id) + $1;

        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