Permalink
Browse files

Fix issue 2 - missing 'defined' so the value of green being zero eval…

…uated as false.
  • Loading branch information...
1 parent 4c4fe0a commit a60bd426cd1a600748e478c54739b8e47f48d046 @rbramley committed Sep 20, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 check_elasticsearch
View
@@ -142,7 +142,7 @@ if ( $res->is_success ) {
# print "Cluster name: $obj->{cluster_name}";
$retStr = "$obj->{cluster_name} health = $obj->{status}";
- if ( $statusCodesMap{$obj->{status}} ) {
+ if ( defined $statusCodesMap{$obj->{status}} ) {
$exitCode = $statusCodesMap{$obj->{status}};
}
else {
@@ -151,7 +151,7 @@ if ( $res->is_success ) {
}
}
elsif( $metric eq 'index_status') {
- if ( $obj->{indices}->{$indexName} ) {
+ if ( defined $obj->{indices}->{$indexName} ) {
# check for a specific index name
$retStr = "$indexName health = $obj->{indices}->{$indexName}->{status}";
@@ -169,7 +169,7 @@ if ( $res->is_success ) {
}
}
elsif( $metric eq 'shard_status') {
- if ( $obj->{indices}->{$indexName} ) {
+ if ( defined $obj->{indices}->{$indexName} ) {
my %stateCounts = ( "green"=>0, "yellow"=>0, "red"=>0 );
my $i = 0;
my $j = $obj->{indices}->{$indexName}->{number_of_shards};

0 comments on commit a60bd42

Please sign in to comment.