Hi,
I am writing an "advanced" sensor using PowerShell. The task is to monitor a scheduled event which takes place hourly from 06:00 to 20:00. Currently the sensor channel reports the time delta between "now" and the most recent event, which was a bit tricky to achieve but works fine. This is only one of 3 or 4 channels which are also under development.
I want the channel to go into error state when the most recent execution is more than 120 minutes in the past, except when the current time of day is between 20:00 and 06:00. How do I manage that? If I understand the documentation correctly:
- adding <error>1</error> to the <result> means "sensor is not working," rather than "sensor is ok but the value is bad." The actual sensor value is not displayed in this case.
- adding <LimitMaxError> has an effect only during the first sensor execution, so it is not possible to change the limit automatically, depending on the time of day.
I could subtract the "night time hours" from the time difference but that would, in my eyes, distort the measurement. Is there any other solution?
Thanks a lot
Hans
Article Comments
Maybe adding a channel dedicated to the error status of the actual channel could be a solution.
So your script could output that error channel value according to any logic you want, while keeping the same PRTG settings (i.e. threshold) for the error channel
Feb, 2022 - Permalink
Hello Hans,
Thank you for your message.
Regarding what you would like to achieve, you have the possibility to pause the sensor between 20:00 and 6:00 with a schedule.
Otherwise, you have the possibility to modify/disable the channel limit with the API of PRTG, via the following API calls:
To enable the channel limits again, you just have to replace "value=0" to "value=1" in the request above.
If you have questions, let us know.
Regards.
May, 2021 - Permalink