Hi,

I've a custom script sensor that fetch a variable numeric value provided every 5min by a third part system. If this system "hang" the numeric value will remain constant for a long time.

Is there a way to setup the PRTG sensor to "detect" that the value has not changed in the last n monitoring cycles and throw an alert? The "unusual" state seems not an option so I wonder if this can be achieved in a different way...


Article Comments

Hello Gianluca,

Thank you for your message.

I'm afraid that there is no native option to trigger a notification when the value is the same for x scanning interval.

In this case, you could create a threshold trigger such as the one below and automatically replace the value with the one returned by the sensor (with a script). To do so, you can use the PowerShell module PRTGAPI whose GitHub page and documentation are here: https://github.com/lordmilko/PrtgAPI
https://github.com/lordmilko/PrtgAPI/wiki

Here is the cmdlet you can use to modify the threshold:

# Get the trigger based on its subID
$trigger = Get-Sensor -id SensorID | Get-Trigger -Inherited $false -SubId TriggerSubID

# Change the threshold to the value of the sensor
$trigger | Set-TriggerProperty Threshold Value -Verbose

To get the subID of the trigger, you can use the command below:

Get-Sensor -Id SensorID | Get-Trigger -Inherited $false -Type Threshold

You will find all the information on how to get and modify a notification trigger with PRTGAPI here: https://github.com/lordmilko/PrtgAPI/wiki/Notification-Triggers

Regarding the sensor value, you can use the API of PRTG to get it:

/api/table.json?content=channels&output=json&columns=name,lastvalue_&id=SensorID&usecaption=true&username=PRTGUser&passhash=Passhash

However, please notice that we do not provide support for it as it relies on HTTP request (not the API of PRTG).

If you have questions, let us know.

Regards.


May, 2021 - Permalink