small update

This commit is contained in:
Jordi Sanfeliu 2013-01-22 15:35:31 +01:00
parent f568bc945c
commit 62df041224
1 changed files with 6 additions and 6 deletions

View File

@ -97,7 +97,7 @@ sub system_init {
}
}
$config->{system_hist} = 0;
$config->{system_hist_alert1} = 0;
push(@{$config->{func_update}}, $package);
logger("$myself: Ok") if $debug;
}
@ -280,18 +280,18 @@ sub system_update {
# SYSTEM alert
if(lc($system->{alerts}->{enabled}) eq "y") {
if(!$system->{alerts}->{loadavg_threshold} || $load15 < $system->{alerts}->{loadavg_threshold}) {
$config->{system_hist} = 0;
$config->{system_hist_alert1} = 0;
} else {
if(!$config->{system_hist}) {
$config->{system_hist} = time;
if(!$config->{system_hist_alert1}) {
$config->{system_hist_alert1} = time;
}
if($config->{system_hist} > 0 && (time - $config->{system_hist}) > $system->{alerts}->{loadavg_timeintvl}) {
if($config->{system_hist_alert1} > 0 && (time - $config->{system_hist_alert1}) > $system->{alerts}->{loadavg_timeintvl}) {
if(-x $system->{alerts}->{loadavg_script}) {
system($system->{alerts}->{loadavg_script} . " " .$system->{alerts}->{loadavg_timeintvl} . " " . $system->{alerts}->{loadavg_threshold} . " " . $load15);
} else {
logger("$myself: ERROR: script '$config->{alerts}->{loadavg_script}' doesn't exist or don't has execution permissions.");
}
$config->{system_hist} = time;
$config->{system_hist_alert1} = time;
}
}
}