mirror of https://github.com/mikaku/Monitorix.git
updated alerts options
This commit is contained in:
parent
2f69aa4ae5
commit
332d9ab90b
10
lib/fs.pm
10
lib/fs.pm
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue