From 4a3e374d558ceb3dfd8eaaa7912a3c80f43c0648 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Wed, 3 Dec 2014 15:47:00 +0100 Subject: [PATCH 1/3] Fixed issue https://github.com/willixix/naglio-plugins/issues/51. --- check_files.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_files.pl b/check_files.pl index ce559be..4f820f5 100755 --- a/check_files.pl +++ b/check_files.pl @@ -502,7 +502,7 @@ sub check_options { if (defined($o_age)) { my @agetemp = split(',',$o_age); - $o_age_warn = parse_threshold($agetemp[0]) if defined($agetemp[0]) && $agetemp[0] ne ''; + $o_age_warn = parse_threshold($agetemp[0]) if defined($agetemp[0]) && $agetemp[0] ne '' && $agetemp[0] ne '~'; $o_age_crit = parse_threshold($agetemp[1]) if defined($agetemp[1]) && $agetemp[1] ne ''; } From 2cefa0a0438c6b89f939b12109260ec3df502bb1 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Wed, 3 Dec 2014 15:50:42 +0100 Subject: [PATCH 2/3] Fix: Omitting -w parameter prevented output of critical limit in perfdata --- check_files.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_files.pl b/check_files.pl index 4f820f5..a35aa65 100755 --- a/check_files.pl +++ b/check_files.pl @@ -844,7 +844,7 @@ sub open_shell_stream { $statuscode = "CRITICAL"; $statusinfo .= "," if $statusinfo; $statusinfo .= $chk; - } elsif ($chk = check_threshold($o_filesLv[$i],$nmatches[$i],$o_warnL[$i])) { + } elsif ($o_warnLv[$i] ne '~' && ($chk = check_threshold($o_filesLv[$i],$nmatches[$i],$o_warnL[$i]))) { $statuscode="WARNING" if $statuscode eq "OK"; $statusinfo .= "," if $statusinfo; $statusinfo .= $chk; @@ -854,7 +854,7 @@ sub open_shell_stream { } $perfdata .= " ". perf_name($o_filesLv[$i]) ."=". $nmatches[$i] if defined($o_perf); - if (defined($o_perf) && defined($o_warnL[$i][5]) && defined($o_critL[$i][5])) { + if (defined($o_perf) && (defined($o_warnL[$i][5]) || defined($o_critL[$i][5]))) { $perfdata .= ';' if $o_warnL[$i][5] ne '' || $o_critL[$i][5] ne ''; $perfdata .= $o_warnL[$i][5] if $o_warnL[$i][5] ne ''; $perfdata .= ';'.$o_critL[$i][5] if $o_critL[$i][5] ne ''; From f353283cfbff6f73a920025afa103325afdc97b8 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Wed, 3 Dec 2014 15:51:27 +0100 Subject: [PATCH 3/3] Fixed typos. --- check_files.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_files.pl b/check_files.pl index a35aa65..d3d35b2 100755 --- a/check_files.pl +++ b/check_files.pl @@ -861,7 +861,7 @@ sub open_shell_stream { } } -# perffata for age +# perfdata for age if (defined($o_perf) && defined($o_age)) { $oldest_secold=0 if !defined($oldest_secold); $newest_secold=0 if !defined($newest_secold); @@ -872,7 +872,7 @@ sub open_shell_stream { $perfdata .= " age_newest=".$newest_secold."s"; } -# perffata for size +# perfdata for size if (defined($o_perf) && defined($o_size)) { $largest_filesize=0 if !defined($largest_filesize); $smallest_filesize=0 if !defined($smallest_filesize); @@ -883,7 +883,7 @@ sub open_shell_stream { $perfdata .= " size_smallest=".$smallest_filesize."o"; } -# perffata for sum of file sizes +# perfdata for sum of file sizes if (defined($o_perf) && defined($o_sumsize)) { $perfdata .= " size_sum=".$sum_filesize."o"; $perfdata .= ';' if (defined($o_sumsize_warn) && $$o_sumsize_warn[5] ne '') || (defined($o_sumsize_crit) && $$o_sumsize_crit[5] ne '');