diff --git a/HariSekhon/Cassandra/Nodetool.pm b/HariSekhon/Cassandra/Nodetool.pm index a40f39c0..f9413263 100644 --- a/HariSekhon/Cassandra/Nodetool.pm +++ b/HariSekhon/Cassandra/Nodetool.pm @@ -33,6 +33,7 @@ our @EXPORT = ( qw ( die_nodetool_unrecognized_output nodetool_options skip_nodetool_output + skip_connection_refused validate_nodetool validate_nodetool_options ) @@ -93,10 +94,9 @@ our $nodetool_errors_regex = qr/ You\s+must\s+set | Cannot\s+resolve | unknown\s+host | - connection\s+refused | failed\s+to\s+connect | - error | - user | + error | + user | password | Exception(?!s\s*:\s*\d+) | in thread @@ -105,7 +105,11 @@ our $nodetool_errors_regex = qr/ sub check_nodetool_errors($){ @_ or code_error "no input passed to check_nodetool_errors()"; my $str = join(" ", @_); - quit "CRITICAL", $str if $str =~ /$nodetool_errors_regex/; + if(skip_connection_refused($str)) { + return 1; + }else{ + quit "CRITICAL", $str if $str =~ /$nodetool_errors_regex/; + } } sub skip_nodetool_output($){ @@ -118,6 +122,15 @@ sub skip_nodetool_output($){ return 0; } +sub skip_connection_refused($){ + @_ or code_error "no input passed to skip_nodetool_output()"; + my $str = join(" ", @_); + if($str =~ /connection\s+refused/i) { + return 1; + } + return 0; +} + # Cassandra 2.0 DataStax Community Edition (nodetool version gives 'ReleaseVersion: 2.0.2') our $nodetool_status_header_regex = qr/ ^Note | @@ -133,4 +146,4 @@ sub die_nodetool_unrecognized_output($){ quit "UNKNOWN", sprintf("unrecognized output '%s', nodetool output format may have changed, aborting, $nagios_plugins_support_msg", $str); } -1; +1; \ No newline at end of file