MXS-1227: Update Nagios Plugins for MaxScale 2.1

Nagios Plugins update for MaxScale 2.1
This commit is contained in:
MassimilianoPinto
2017-04-19 16:10:14 +02:00
parent a54d6fe816
commit 5998457142

View File

@ -145,7 +145,7 @@ while ( <MAXSCALE> ) {
next if (/--/ || $_ eq ''); next if (/--/ || $_ eq '');
if ( /\s+Name/) { if ( /Name\:/) {
my $str; my $str;
my $perf_line; my $perf_line;
@ -156,7 +156,7 @@ while ( <MAXSCALE> ) {
} }
if (/(\s+Monitor )(.*)/) { if (/(State\:\s+)(.*)/) {
$monitor_data{$this_key}{'2state'}=$2; $monitor_data{$this_key}{'2state'}=$2;
} }
@ -185,8 +185,7 @@ while ( <MAXSCALE> ) {
} }
} }
for my $key ( sort(keys %monitor_data) ) {
for my $key ( sort(keys %monitor_data) ) {
my $local_hash = {}; my $local_hash = {};
$performance_data .= " $key="; $performance_data .= " $key=";
$local_hash = $monitor_data{$key}; $local_hash = $monitor_data{$key};
@ -195,8 +194,7 @@ while ( <MAXSCALE> ) {
$performance_data .= $new_hash{$key} . ";"; $performance_data .= $new_hash{$key} . ";";
} }
chop($performance_data); chop($performance_data);
} }
if ($n_monitors) { if ($n_monitors) {
printf "OK: %d monitors found |%s\n", $n_monitors, $performance_data; printf "OK: %d monitors found |%s\n", $n_monitors, $performance_data;
@ -207,4 +205,3 @@ if ($n_monitors) {
close(MAXSCALE); close(MAXSCALE);
exit 1; exit 1;
} }