diff --git a/Changes b/Changes index 0e8bdcf..5e32eba 100644 --- a/Changes +++ b/Changes @@ -8,6 +8,10 @@ - Added an advice in monitorix.conf(5) as a reminder that some default values are overwritten in the configuration files on certain systems. (suggested by Sander Bos) +- Changed the alert in 'system.pm' to use the minimum value between the second + and the third load averages to obtain a more symmetric curve and a sooner + cancellation of the alert. + (suggested by Michael Tosch) - Fixed a bad memory scaling in *BSD systems. - Fixed in 'process.pm' to fully honour the option 'netstats_in_bps'. - Fixed to force Monitorix to be started at the end of boot in systemd-based diff --git a/lib/system.pm b/lib/system.pm index f3cee18..eab0180 100644 --- a/lib/system.pm +++ b/lib/system.pm @@ -380,7 +380,10 @@ sub system_update { # SYSTEM alert if(lc($system->{alerts}->{loadavg_enabled}) eq "y") { - if(!$system->{alerts}->{loadavg_threshold} || $load15 < $system->{alerts}->{loadavg_threshold}) { + my $load; + + $load = min($load5, $load15); + if(!$system->{alerts}->{loadavg_threshold} || $load < $system->{alerts}->{loadavg_threshold}) { $config->{system_hist_alert1} = 0; } else { if(!$config->{system_hist_alert1}) { @@ -389,7 +392,7 @@ sub system_update { if($config->{system_hist_alert1} > 0 && (time - $config->{system_hist_alert1}) >= $system->{alerts}->{loadavg_timeintvl}) { if(-x $system->{alerts}->{loadavg_script}) { logger("$myself: ALERT: executing script '$system->{alerts}->{loadavg_script}'."); - system($system->{alerts}->{loadavg_script} . " " .$system->{alerts}->{loadavg_timeintvl} . " " . $system->{alerts}->{loadavg_threshold} . " " . $load15); + system($system->{alerts}->{loadavg_script} . " " .$system->{alerts}->{loadavg_timeintvl} . " " . $system->{alerts}->{loadavg_threshold} . " " . $load); } else { logger("$myself: ERROR: script '$system->{alerts}->{loadavg_script}' doesn't exist or don't has execution permissions."); } diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index a9d0754..fcdcb27 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -505,7 +505,9 @@ Default value: \fIreal\fP .RS This section enables or disables the alert capabilities for this graph. Only the alert for the average CPU load is currently implemented. It works as follows: .P -The CPU load average uses the third value (the one that represents the last 15 minutes of the load average), and if it reaches the \fBloadavg_threshold\fP value for the interval of time defined in \fBloadavg_timeintvl\fP, Monitorix will execute the external alert script defined in \fBloadavg_script\fP. +This alert uses the minimum value between the second and the third load averages (those that represent the last 5 and 15 minutes), and if it reaches the \fBloadavg_threshold\fP value for the interval of time defined in \fBloadavg_timeintvl\fP, Monitorix will execute the external alert script defined in \fBloadavg_script\fP. +.P +The idea to use \fImin(load5, load15)\fP is to obtain a more symmetric curve and a sooner cancellation of the alert. .P The default Monitorix installation includes an example of a shell-script alert called \fBmonitorix-alert.sh\fP which you can use as a base for your own script. .P