updated alerts options

This commit is contained in:
Jordi Sanfeliu 2013-01-09 12:43:18 +01:00
parent 2f69aa4ae5
commit 332d9ab90b
2 changed files with 13 additions and 13 deletions

View File

@ -355,16 +355,16 @@ sub fs_update {
$use = ($used * 100) / ($used + $free);
# FS alert
if($f eq "/" && lc($config->{enable_alerts}) eq "y") {
if(!$config->{alert_rootfs_threshold} || $use < $config->{alert_rootfs_threshold}) {
if($f eq "/" && lc($config->{alerts}->{enabled}) eq "y") {
if(!$config->{alerts}->{rootfs_threshold} || $use < $config->{alerts}->{rootfs_threshold}) {
$config->{fs_hist}->{rootalert} = 0;
} else {
if(!$config->{fs_hist}->{rootalert}) {
$config->{fs_hist}->{rootalert} = time;
}
if($config->{fs_hist}->{rootalert} > 0 && (time - $config->{fs_hist}->{rootalert}) > $config->{alert_rootfs_timeintvl}) {
if(-x $config->{alert_rootfs_script}) {
system($config->{alert_rootfs_script} . " " . $config->{alert_rootfs_timeintvl} . " " . $config->{alert_rootfs_threshold} . " " . $use);
if($config->{fs_hist}->{rootalert} > 0 && (time - $config->{fs_hist}->{rootalert}) > $config->{alerts}->{rootfs_timeintvl}) {
if(-x $config->{alerts}->{rootfs_script}) {
system($config->{alerts}->{rootfs_script} . " " . $config->{alerts}->{rootfs_timeintvl} . " " . $config->{alerts}->{rootfs_threshold} . " " . $use);
}
$config->{fs_hist}->{rootalert} = time;
}

View File

@ -90,9 +90,9 @@ sub system_init {
}
# check dependencies
if(lc($config->{enable_alerts}) eq "y") {
if(! -x $config->{alert_loadavg_script}) {
logger("$myself: ERROR: script '$config->{alert_loadavg_script}' doesn't exist or don't has execution permissions.");
if(lc($config->{alerts}->{enabled}) eq "y") {
if(! -x $config->{alerts}->{loadavg_script}) {
logger("$myself: ERROR: script '$config->{alerts}->{loadavg_script}' doesn't exist or don't has execution permissions.");
}
}
@ -276,16 +276,16 @@ sub system_update {
);
# SYSTEM alert
if(lc($config->{enable_alerts}) eq "y") {
if(!$config->{alert_loadavg_threshold} || $load15 < $config->{alert_loadavg_threshold}) {
if(lc($config->{alerts}->{enabled}) eq "y") {
if(!$config->{alerts}->{loadavg_threshold} || $load15 < $config->{alerts}->{loadavg_threshold}) {
$config->{system_hist} = 0;
} else {
if(!$config->{system_hist}) {
$config->{system_hist} = time;
}
if($config->{system_hist} > 0 && (time - $config->{system_hist}) > $config->{alert_loadavg_timeintvl}) {
if(-x $config->{alert_loadavg_script}) {
system($config->{alert_loadavg_script} . " " .$config->{alert_loadavg_timeintvl} . " " . $config->{alert_loadavg_threshold} . " " . $load15);
if($config->{system_hist} > 0 && (time - $config->{system_hist}) > $config->{alerts}->{loadavg_timeintvl}) {
if(-x $config->{alerts}->{loadavg_script}) {
system($config->{alerts}->{loadavg_script} . " " .$config->{alerts}->{loadavg_timeintvl} . " " . $config->{alerts}->{loadavg_threshold} . " " . $load15);
}
$config->{system_hist} = time;
}