Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip connection refused to allow checking from different host in a Cassandra cluster #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions HariSekhon/Cassandra/Nodetool.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ our @EXPORT = ( qw (
die_nodetool_unrecognized_output
nodetool_options
skip_nodetool_output
skip_connection_refused
validate_nodetool
validate_nodetool_options
)
Expand Down Expand Up @@ -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
Expand All @@ -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($){
Expand All @@ -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 |
Expand All @@ -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;