Cacti / plugin_syslog

Syslog Plugin for Cacti
GNU General Public License v2.0
21 stars 16 forks source link

Re-Alert Cycle (Alert Rules) is wrong in case of 1 minute poller interval #99

Closed aleksashka closed 4 years ago

aleksashka commented 4 years ago

I managed to find out that line 392 of syslog_alerts.php defines repeatarray using 5-minute intervals (1, 2, 3 for 5, 10, and 15 minutes respectively), which is totally fine with 5-minute poller_interval, since repeat value later gets multiplicated by poller_interval in line 346 of syslog_process.php for calculating silence time.

Unfortunately, selecting 30-minutes Re-Alert Cycle with 1-minute poller_interval effectively uses 6-minute cycle.

From newbie's point of view it seems that it should be OK to multiply repeat values by 300 seconds no matter what poller_interval is (works fine in my case, not sure why poller_inteval was used in first place). Unfortunately, I am not totally sure this will not break something else :).

netniV commented 4 years ago

The repeat_alert is independent of any polling time from what I can see so should be 60 seconds, not 300 (5 minutes). The reason being that 1 minute is 60 seconds and the array clear states minutes, not polling intervals. If you multiply it by 300, you'll effectively get 1 minute = 5 minutes.

We can fix that our end, later of if you like, you can submit a pull request with the change?

aleksashka commented 4 years ago

Take a look at lines 394 and 395 of syslog_alerts.php:

        1    => __('%d Minutes', 5, 'syslog'),
        2    => __('%d Minutes', 10, 'syslog'),

Choosing 10 Minutes Re-Alert Cycle stores value 2 in database, which later gets multiplied by poller_interval. If poller_interval is set to 5 minutes, then everything is fine. Otherwise, Re-Alert is not working as expected.

netniV commented 4 years ago

Yes, sorry, didn't look too closely, my bad. So, your original 300 would be right as long as everything was in 5 minute intervals. However, I think some realignment is needed, wouldn't you agree if you look at https://github.com/Cacti/plugin_syslog/blob/develop/syslog_alerts.php#L399 ?

cigamit commented 4 years ago

This should be resolved now.