Testing Conditions

Ciaran Bryan

24-08-2004 11:30:53


I've been using the conditions feature to send responses( snmp notifications) if a value returned by a test exceeds a pre-configured max.


if current value >=80
do response

I need to then check on the next run if the condition has abated in order to send an snmp clear notification


if current value is now less that previous value
do response

Cant figure out a way to evaluate this using the Value Type fields and logical operators provided. (CurVal, DeltaVal, RateofChangeVal)

I need a PreviousVal field or last non "U" value from the rrd to be returned.

Any ideas ?



24-08-2004 18:22:17

I agree... We'll try to get this feature into the next release. Thanks for the idea!


Ciaran Bryan

25-08-2004 07:02:16


There is a way to do it by using the rate of change value type.

if cur val is smaller that previous val i.e. condition has ceased
rate val = delta val/delta time
will always be negative as time always increases

This would do the trick to determine the condition but there is a problem

The process_condition function gets passed the sql row element rate val as a string then converts to an integer

so if the roc val = -0.023 then strtoint converts to 0 so you cant use a condition such as if roc < 0 then do whatever, because it will never return true.




25-08-2004 08:50:47

Why can't you just use delta values, which should remain integral?

Ciaran Bryan

25-08-2004 10:26:01

Let's see.

Take the case where the monitor always returns zero.

I want to see it it ever goes over a threshold of 50.

Next run it goes to 55
then on the next run i want to see if the condition is abated
Next run its back to 45

then the following would work
Current value < 50
Delta Value < 0

But this setup would always be TRUE even if the return value never breeched the 50 limit.

I really kneed to know the last actual value available thats not "U"
Even though I know the delta I can never determine the previous in order to use it in the logic.


Ciaran Bryan

25-08-2004 10:30:22

So. i suppose what I need is.

if lastval >= 50
curval <50

then condition is true.

I've looked up bug 258 and you seem to have maybe added this already ?

Also, just wondering when v 0.17 is planned for release ?

thanks a mill,


25-08-2004 11:27:18

Yeah, I believe I got that bug fixed. As for when 0.17 is to be released, my hope is within a month.

Ciaran Bryan

25-08-2004 12:57:00


i made the changed to events.cpp and added

3 => "Last Value"

to VALUE_TYPES array in stat.php

Tested condition if last_val = xx and it works fine.

Thanks a lot,



25-08-2004 12:59:43

Excellent! I'm glad NetMRG was able to accomodate your needs. Thanks for the testing, and the insight.