MXS-1227: Update Nagios Plugins for MaxScale 2.1
Nagios Plugins update for MaxScale 2.1
This commit is contained in:
@ -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,47 +156,45 @@ while ( <MAXSCALE> ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/(\s+Monitor )(.*)/) {
|
if (/(State\:\s+)(.*)/) {
|
||||||
$monitor_data{$this_key}{'2state'}=$2;
|
$monitor_data{$this_key}{'2state'}=$2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( /Monitored servers\:/ ) {
|
if ( /Monitored servers\:/ ) {
|
||||||
my $server_list;
|
my $server_list;
|
||||||
my @data_row = split(':', $_);
|
my @data_row = split(':', $_);
|
||||||
shift(@data_row);
|
shift(@data_row);
|
||||||
foreach my $name (@data_row) {
|
foreach my $name (@data_row) {
|
||||||
$name =~ s/^\s+|\s+$//g;
|
$name =~ s/^\s+|\s+$//g;
|
||||||
$name =~ s/ //g;
|
$name =~ s/ //g;
|
||||||
$server_list .= $name . ":";
|
$server_list .= $name . ":";
|
||||||
}
|
}
|
||||||
chop($server_list);
|
chop($server_list);
|
||||||
$monitor_data{$this_key}{'3servers'}=$server_list;
|
$monitor_data{$this_key}{'3servers'}=$server_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( /(Sampling interval\:)\s+(\d+) milliseconds/ ) {
|
if ( /(Sampling interval\:)\s+(\d+) milliseconds/ ) {
|
||||||
$monitor_data{$this_key}{'4interval'}=$2;
|
$monitor_data{$this_key}{'4interval'}=$2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( /Replication lag\:/ ) {
|
if ( /Replication lag\:/ ) {
|
||||||
my @data_row = split(':', $_);
|
my @data_row = split(':', $_);
|
||||||
my $name = $data_row[1];
|
my $name = $data_row[1];
|
||||||
$name =~ s/^\s+|\s+$//g;
|
$name =~ s/^\s+|\s+$//g;
|
||||||
$monitor_data{$this_key}{'5repl_lag'}=$name;
|
$monitor_data{$this_key}{'5repl_lag'}=$name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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};
|
my %new_hash = %$local_hash;
|
||||||
my %new_hash = %$local_hash;
|
foreach my $key (sort (keys (%new_hash))) {
|
||||||
foreach my $key (sort (keys (%new_hash))) {
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user