Forum Discussion

Joe_Williams's avatar
6 years ago

Complex Datapoint and limit

I am writing a custom datasource for a temperature monitor. We want to alert on if the temperature falls to high or to low. I figured limit would be what we want.

This is what I have so far, no matter what it returns 0 tho. I have adjusted the numbers so Temperature falls outside and inside the range and it always returns 0. 

if(limit(Temperature, 46, 60), 0, 1)

Is my understanding of this wrong?

 

Eventually I would chain this to return different numbers based on Error and Critical thresholds, but can't get this even started lol.

  • Based on the Limit documentation and without testing it, you have the right understanding. This would report 0 if ok and 1 if under/over but this also means the alert it would generate wouldn't provide any details like what is the temp actually is.

    Perhaps you can try having two complex datapoints called something like UnderTemp and OverTemp which each just have an expression of "Temperature" (basically cloning the normal datapoint) but one you can set thresholds of < 46 and the other > 60. That way you can report both that the temp was over/under with custom messages and have the temperature right in the alert. Makes it also easy to do warn/error/crit.

    Actually you can just clone the original Temperature datapoint without having to use complex datapoints (Poll Now would work this way) but I think complex Datapoints would make it more clear.