I am building a custom sensor using the EXE/Script Advanced sensor. It's a PowerShell script that returns some ping, trace route, etc stats in the channels. I want to trigger a notification only is the string in the Message changes. I know the Message isn't logged so I have created a channel that is a hash of the string in Message. So if this hash changes I want a notification to trigger.
I've tried adding <NotifyChanged> to the Hash channel but that trigger a Change Notification every time the sensor runs. Any ideas how I could trigger a Notification ONLY is the Hash channel changes?
Article Comments
Hell Dan,
thank you for your KB-Post.
PRTG will simply trigger the "change notification" when <NotifyChanged> is part of the result.
You need to figure if there was a change within the script itself. For example, store the previous result to disk (write the hash to a temporary file) and then read that file again in the next run, compare the hashes and decide if the value changed and then based on this include or don't include <NotifyChanged> in the next result.
In parallel, store the "new" hash to the "cache file" to process it on the next scan.
Best Regards,
Luciano Lingnau [Paessler Support]
Nov, 2017 - Permalink
Hell Dan,
thank you for your KB-Post.
PRTG will simply trigger the "change notification" when <NotifyChanged> is part of the result. You need to figure if there was a change within the script itself. For example, store the previous result to disk (write the hash to a temporary file) and then read that file again in the next run, compare the hashes and decide if the value changed and then based on this include or don't include <NotifyChanged> in the next result.
In parallel, store the "new" hash to the "cache file" to process it on the next scan.
Best Regards,
Luciano Lingnau [Paessler Support]
Nov, 2017 - Permalink