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

This commit is contained in:
Jordi Sanfeliu 2018-03-01 16:32:56 +01:00
parent 46fcd2d729
commit 677ddbcfbc
3 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -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.");
}

View File

@ -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