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