From 31b1752ff8c45dc9d6564b3db598aed51c73ab4e Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Tue, 6 Mar 2018 09:57:50 +0100 Subject: [PATCH] small fixes --- lib/disk.pm | 4 ++-- lib/system.pm | 2 +- monitorix | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/disk.pm b/lib/disk.pm index 97fd727..6c308db 100644 --- a/lib/disk.pm +++ b/lib/disk.pm @@ -160,12 +160,12 @@ sub disk_init { } # check dependencies - if(lc($disk->{alerts}->{realloc_enabled}) eq "y") { + if(lc($disk->{alerts}->{realloc_enabled} || "") eq "y") { if(! -x $disk->{alerts}->{realloc_script}) { logger("$myself: ERROR: script '$disk->{alerts}->{realloc_script}' doesn't exist or don't has execution permissions."); } } - if(lc($disk->{alerts}->{pendsect_enabled}) eq "y") { + if(lc($disk->{alerts}->{pendsect_enabled} || "") eq "y") { if(! -x $disk->{alerts}->{pendsect_script}) { logger("$myself: ERROR: script '$disk->{alerts}->{pendsect_script}' doesn't exist or don't has execution permissions."); } diff --git a/lib/system.pm b/lib/system.pm index eab0180..28dbed9 100644 --- a/lib/system.pm +++ b/lib/system.pm @@ -122,7 +122,7 @@ sub system_init { } # check dependencies - if(lc($system->{alerts}->{loadavg_enabled}) eq "y") { + if(lc($system->{alerts}->{loadavg_enabled} | "") eq "y") { if(! -x $system->{alerts}->{loadavg_script}) { logger("$myself: ERROR: script '$system->{alerts}->{loadavg_script}' doesn't exist or don't has execution permissions."); } diff --git a/monitorix b/monitorix index 5f219da..9ca09f6 100755 --- a/monitorix +++ b/monitorix @@ -147,7 +147,7 @@ sub create_index { } # Piwik tracking code - if(lc($config{piwik_tracking}->{enabled}) eq "y") { + if(lc($config{piwik_tracking}->{enabled} || "") eq "y") { $piwik_url = $config{piwik_tracking}->{url} || ""; $piwik_sid = $config{piwik_tracking}->{sid} || ""; $piwik_img = $config{piwik_tracking}->{img} || ""; @@ -230,7 +230,7 @@ EOF print(OUT " \n"); print(OUT " \n"); - if(scalar(my @remotehost_list = split(',', $config{multihost}->{remotehost_list})) && lc($config{multihost}->{enabled}) eq "y") { + if(scalar(my @remotehost_list = split(',', $config{multihost}->{remotehost_list})) && lc($config{multihost}->{enabled} || "") eq "y") { print(OUT " \n"); print(OUT " \n"); for($n = 0; $n < scalar(@remotehost_list); $n++) { @@ -249,7 +249,7 @@ EOF } } - if(scalar(my @tal = split(',', $config{traffacct}->{list})) && lc($config{traffacct}->{enabled}) eq "y") { + if(scalar(my @tal = split(',', $config{traffacct}->{list})) && lc($config{traffacct}->{enabled} || "") eq "y") { print(OUT " \n"); print(OUT " \n"); for($n = 0; $n < scalar(@tal); $n++) { @@ -616,7 +616,7 @@ logger("Initializing graphs."); # check for inconsistencies between enabled graphs and defined graphs foreach my $g (sort keys %{$config{graph_enable}}) { - if(lc($config{graph_enable}->{$g}) eq "y") { + if(lc($config{graph_enable}->{$g} || "") eq "y") { if(!grep {trim($_) eq $g} (split(',', $config{graph_name}))) { logger("WARNING: inconsitency between '' and 'graph_name' options; '$g' doesn't exist."); } @@ -629,9 +629,9 @@ foreach (split(',', $config{graph_name} . ", traffacct")) { my $e = "n"; if($g eq "traffacct") { - $e = lc($config{$g}->{enabled}); + $e = lc($config{$g}->{enabled} || ""); } else { - $e = lc($config{graph_enable}->{$g}); + $e = lc($config{graph_enable}->{$g} || ""); } if($e eq "y") {