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. Event Processing Policy Filtering Script

Event Processing Policy Filtering Script

Scheduled Pinned Locked Moved Support
5 Posts 2 Posters 29.0k 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.
  • T
    T
    tfines
    wrote on last edited by
    #1

    I am using NetXMS 3.4.

    All nodes have all filesystems discovered with instance discovery.  However, I only want and email alert if C:\ free space reaches a threshold.

    I thought creating a Filtering Script in the EPP would be the way to do this, but I continue to get alerts for ALL filesystems.

    Here is my script:

    if (%6 ilike "C:\\") {
    	return true;
    }
    return false;
    

    I've also tried variations like below but they don't work either.

    if (%6 ilike "*C:\\*") {
    or
    if (%1 ilike "*C:\\*") {
    

    Here is the body of an email alert I receive for D:\, which I thought the above script would filter out.  (I have the alert threshold set to 92 for testing, so the events keep getting triggered.)
    FQDN: Jacques-PC.odcvu.local
    Zone:0
    Severity:[3]
    Name: JACQUES-PC
    Message: D:\ disk low (17.853211% remaining)
    1 is FileSystem.FreePerc(D:\)
    2 is File system: free space on D:\ (%)
    3 is 92
    4 is 17.853211
    5 is 0x00002688
    6 is 😧
    7 is 0
    8 is 17.853211
    9 is

    On a related topic, the EPP Filtering Script 'Hint' text reads there is a local variable "EVENT_TEXT" you can use.  One, is that the equivalent of %m?  And two, is the correct syntax for that:

    if (EVENT_TEXT like "something") {
    or
    if ($EVENT_TEXT like "something") {
    or
    if (%EVENT_TEXT like "something") {
    ...or something else?
    

    What is wrong with my script?  What should be changed?  Thanks!

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

      Hi,

      syntax for accessing event parameters within filter script is different from macro expansion. You can access event object via global variable $event. It has attribute "parameters" which is array of all event parameters. You can either use this attribute or you can use expandString method to expand standard macros. So your filter script could be in one of two forms:

      return $event->parameters[6] ilike "C:\\";
      

      or

      return $event->expandString("%6") ilike "C:\\";
      

      Best regards,
      Victor

      1 Reply Last reply
      0
      • T
        T
        tfines
        wrote on last edited by
        #3

        Thank you!

        1 Reply Last reply
        0
        • T
          T
          tfines
          wrote on last edited by
          #4

          Hi Victor. 

          You suggested to use %6, but when I dump the %1...%9 variables in my email message, for troubleshooting, %6 is empty.  Do the %1 variables in filtering scripts not match those used in Actions?

          FQDN: Ted-Win10VM.odcvu.local
          Zone:0
          Severity:[3]
          Name: Ted-Win10VM
          Message:  disk low (66.925406% remaining)
          1 is FileSystem.FreePerc(C:\)
          2 is ODC- C:\ free space
          3 is 70
          4 is 66.925406
          5 is 0x0000279F
          6 is
          7 is 0
          8 is 66.925406
          9 is
          
          1 Reply Last reply
          0
          • V
            V
            Victor Kirhenshtein
            wrote on last edited by
            #5

            Hi,

            they match. If %6 expands to empty string it means that "instance" attributre in DCI is not set. Are those DCIs created by instance discovery or manually? If manually, did you set "instance" field?

            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