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. Filtering Script on Event Processing Policy request value from other dci

Filtering Script on Event Processing Policy request value from other dci

Scheduled Pinned Locked Moved Support
6 Posts 2 Posters 13.4k 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.
  • SashS
    SashS
    Sash
    wrote on last edited by
    #1

    Hi all,

    I have a Event Processing Policy which send me an Alarm If a Networkinterface has more than 5 Errors / min. 
    Now I want to filter that a Alarm is only generated when the Interface is not on halfduplex mode.

    For both I have set a DCI.

    Unfortunally I have no Idea how I can match the other DCI in the Filterscript...

    Some Ideas?

    Thanks a lot.


    DCI.jpg

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2

      In event processing policy you can use a filter script like this:

      ifName = $dci->instance;
      if (ifName == null or ifName == "") return false;
      
      dciDescription = "Port Speed auf " . ifName;
      portSpeed = GetDCIValueByDescription($node, dciDescription);
      
      if (portSpeed->contains("HD")) return false;
      
      return true;
      

      $dci->instance will work if your DCIs are created by instance discovery, otherwise you might need to get the interface name by parsing description.

      Alternative approach could be to use script threshold on your network error DCIs - that script could also get value of port speed DCI and generate threshold violation event only when both conditions are met. This way you would have less events (which also consume resources as they are stored in the DB).

      Feel free to ask if you need more script examples.

      1 Reply Last reply
      0
      • SashS
        SashS
        Sash
        wrote on last edited by
        #3

        Hi Filipp,

        sorry for the late response. Thanks for the example.

        I use it now in Threshold Script.
        The Script

        1 dciDescription = "Port Speed auf 1/1/3";
        2 portSpeed = GetDCIValueByDescription($node, dciDescription);
        3
        4 if (portSpeed->contains("HD")) return true;
        5
        6 return false;

        is working - but everytime I restart the NetXMS Server I get an Error about the Script:

        Script (DCI::xxx - xxx::10165::12568::ThresholdScript) execution error: Error 14 in line 4: Function or operation argument is not an object

        Where´s my Misstake?

        Thanks for your Help.

        1 Reply Last reply
        0
        • F
          F
          Filipp Sudanov
          wrote on last edited by
          #4

          Yes, threshold script is a better place for this.

          If you open hint in editor of threshold script, you'll see:
          $1 current DCI value;
          $2 threshold value;
          $dci this DCI object;
          $isCluster true if DCI is on cluster;
          $node current node object (null if DCI is not on the node);
          $object current object.

          So you can use $1 instead of GetDCIValueByDescription($node, dciDescription);, this would give you current value of the DCI.

          GetDCIValueByDescription() actually gets previously collected value, when server starts, values for frequently collected DCIs are not cached from database to memory, that's would explain script error.

          1 Reply Last reply
          0
          • SashS
            SashS
            Sash
            wrote on last edited by
            #5

            Hi Filipp.

            thanks for your reply.

            $1 is current DCI value - this is matched to the "Eingehende Fehlerrate" DCI - but I need the value from the "Port Speed auf x/x/x"
            So I can´t use $1 in this script.

            DCI Template:

            Data Collection in Node:

            right?

            1 Reply Last reply
            0
            • F
              F
              Filipp Sudanov
              wrote on last edited by
              #6

              Looks like some screenshots are missing.
              But a question regarding your text - may be you can just use your threshold script right on "Port Speed auf x/x/x" DCI?

              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