From cbb851f8485d12ada176bf8f8d4a1c5379ed5cbb Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Fri, 25 May 2018 09:40:40 +0200 Subject: [PATCH 1/2] check_ctdb: return WARNING when no script was run Signed-off-by: Mathieu Parent --- ctdb/utils/nagios/check_ctdb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ctdb/utils/nagios/check_ctdb b/ctdb/utils/nagios/check_ctdb index 7803f9a6c3d..30cea0bf003 100755 --- a/ctdb/utils/nagios/check_ctdb +++ b/ctdb/utils/nagios/check_ctdb @@ -223,6 +223,10 @@ if ($info eq "scriptstatus") { if ($result == OK) { $result = $np->check_threshold(check => $error_script_count, warning => '0', critical => '0'); } + if ($result == OK and $script_count == 0) { + $result = WARNING; + $output .= "no script run. "; + } } $np->nagios_exit($result, $output); } elsif ($info eq "ping") { From 174442b4cfd3d7c56ad97eaaf1ad43fbbb7a5f71 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Fri, 25 May 2018 15:24:12 +0200 Subject: [PATCH 2/2] check_ctdb: Fix scriptstatus split split parameter is a regular expression. Signed-off-by: Mathieu Parent --- ctdb/utils/nagios/check_ctdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctdb/utils/nagios/check_ctdb b/ctdb/utils/nagios/check_ctdb index 30cea0bf003..279cf6bac43 100755 --- a/ctdb/utils/nagios/check_ctdb +++ b/ctdb/utils/nagios/check_ctdb @@ -187,7 +187,7 @@ if ($info eq "scriptstatus") { next if $. == 1; # Header $script_count++; chop; - my ($col0, $type, $name, $code, $status, $start, $end, @error) = split("|"); + my ($col0, $type, $name, $code, $status, $start, $end, @error) = split('\|'); if ($col0 ne '') { # Old version, before 30 Aug 2011 and commit a779d83a6213 ($type, $name, $code, $status, $start, $end, @error) = ($col0, $type, $name, $code, $status, $start, $end, @error);