Unsigned Integer DCI and diff()

Started by Tursiops, April 19, 2016, 02:24:35 AM

Previous topic - Next topic

Tursiops

I've been monitoring UPS runtime, and as that really should never go into a negative value, I thought I'd use an unsigned integer for the DCI.
I also used a threshold to alert if the runtime dropped by 20 minutes within 1 minute, kind of as an indicator that the battery is on its way out.

The result of the above setup is that the threshold gets triggered a lot. Every time the runtime goes down, it triggers.
For all I can tell this is due to the unsigned integer. If the the difference to the previous value is negative (i.e. from 120 to 116, a difference of -4), it compares the threshold of 20 with 4294967292 (i.e. 2^32 - diff). I don't think the unsigned integer class for the actual value should apply to the result of the diff?
Or did is this some other odd issue I ran into? Since switching from Unsigned Int to Integer, I'm not getting these alerts anymore.

Victor Kirhenshtein

Hi,

it's actually a bug, diff definitely should be treated as signed value. I'll register it in our issue tracker.

Best regards,
Victor

Victor Kirhenshtein

Fixed in version 2.1-M2.

Best regards,
Victor