![](https://secure.gravatar.com/avatar/a48a43e509ce8b6f7655db66a387c343.jpg?s=120&d=mm&r=g)
Hi,
I fixed it myself. I don’t know why, but the alerts.inc.php contains a “unit_string_to_int()” function for the alert check reference value. So a 2.234 is converted to 2, so the comparison fails.
After making some adjustments to the alerts.inc.php, it is finally working now.
//if ($value_a >= unit_string_to_int($value_b)) { $alert = TRUE; } else { $alert = FALSE; } if ($value_a >= $value_b) { $alert = TRUE; } else { $alert = FALSE; } break; case 'le': case '<=': //if ($value_a <= unit_string_to_int($value_b)) { $alert = TRUE; } else { $alert = FALSE; } if ($value_a <= $value_b) { $alert = TRUE; } else { $alert = FALSE; } break; case 'gt': case 'greater': case '>': //if ($value_a > unit_string_to_int($value_b)) { $alert = TRUE; } else { $alert = FALSE; } if ($value_a > $value_b) { $alert = TRUE; } else { $alert = FALSE; } break; case 'lt': case 'less': case '<': //if ($value_a < unit_string_to_int($value_b)) { $alert = TRUE; } else { $alert = FALSE; } if ($value_a < $value_b) { $alert = TRUE; } else { $alert = FALSE; } break; case 'notequals': case 'isnot': case 'ne': case '!=': //if ($value_a != unit_string_to_int($value_b)) { $alert = TRUE; } else { $alert = FALSE; } if ($value_a != $value_b) { $alert = TRUE; } else { $alert = FALSE; } break; case 'equals': case 'eq': case 'is': case '==': case '=': //if ($value_a == unit_string_to_int($value_b)) { $alert = TRUE; } else { $alert = FALSE; } if ($value_a == $value_b) { $alert = TRUE; } else { $alert = FALSE; }
Can someone please explain why these function where there? And otherwise commit the changes to the code, so that it is fixed for everyone?
Thanks and regards!
Bastiaan
Van: Bastiaan Topper Verzonden: maandag 2 juni 2014 09:32 Aan: Observium Network Observation System Onderwerp: RE: [Observium] 2 things with alerting
Hi Adam,
Thanks for your response.
1. Thanks for fixing the frontpage thing.
2. The alert_checks page is solved by increasing the php memory, thanks for that tip. This problem still persists with the alerts for the sensors. It looks like it is only a subset of sensors which fails. If I for example change the "greater" to "less" then (ofcourse) all my sensors give a fail on the check. I removed half of the check, so only the "sensor_value greater @sensor_limit" part stays.
[cid:image001.png@01CF84E8.B7D56B50]
As you can see above, the sensor is failed, but the values are in the correct range, so as far as I can see, this should be a Good instead of fail.
If I check the debug logs for this senors I see on row 14601 that the check fails, while the next check (row 14627) succeeds, but I don’t understand why, because both checks should succeed (3,295 is still smaller than 3,78925).
I hope this makes things a bit more clear?
Thanks and regards,
Bastiaan
-----Oorspronkelijk bericht----- Van: Adam Armstrong [mailto:adama@memetic.org] Verzonden: donderdag 24 april 2014 19:45 Aan: Observium Network Observation System Onderwerp: Re: [Observium] 2 things with alerting
On 2014-04-23 02:12, Bastiaan Topper wrote:
Hi,
We have 2 strange things with the alerting system since a few days.
The frontpage displays ports up/down, even when the alerting for that
port is disabled in the device settings. Is this normal? Because this
wasn't till a few days ago.
This should be fixed now.
Some alert checks worked fine for months, but now they fail. (I only
have the database output, because the http://observium/alert_checks/
[1] links returns a blank page, maybe because the result is too big?):
I attached the debug poll of one of the devices. The polling debug
output returns:
Checking alert 4 associated by 4
replaced @sensor_limit with 5.92 from entity. Testing: sensor_value
greater 5.92 (value: 5.187) FAIL replaced @sensor_limit_low with 4.37
from entity. Testing: sensor_value less 4.37 (value: 5.187) OK Checks
failed. Generate alert.
What I expect (and what it did for the last months) this alert rule to
do, is to fail when the sensor value is not between the threshold
ranges. It looks like it is only for the voltage and current sensors.
When I check the settings and alerting thresholds, they look fine to
me.
Am I doing something wrong? Or is this some kind of bug?
I'm not sure why this is happening. I there were some changes to the parsing of the "less/greater/etc" part of the test, but it looks ok and works fine for me.
You probably need to increase the amount of memory PHP is allowed to use to see the entire alert_checks page.
adam.