Add verbose and regexp for stopped resources

Add 'long_msg' options to extend verbose informations
Add an 'or' on stopped resources regexp test to take into account both unmanaged stop and crm stop as the output is not the same :
centengine (ocf:💓centengine):    Stopped (unmanaged)
centengine (ocf:💓centengine):    (target-role:Stopped) Stopped
This commit is contained in:
cgagnaire 2017-01-20 13:24:26 +01:00 committed by GitHub
parent 536419ed01
commit c9ba9bb47b
1 changed files with 5 additions and 3 deletions

View File

@ -102,11 +102,13 @@ sub parse_output {
# Check Resources pos # Check Resources pos
if (defined($self->{resources_check}->{$1}) && $self->{resources_check}->{$1} ne $2) { if (defined($self->{resources_check}->{$1}) && $self->{resources_check}->{$1} ne $2) {
$self->{output}->output_add(severity => $self->{threshold}, $self->{output}->output_add(severity => $self->{threshold},
short_msg => "Resource '$1' is on node '$2'"); short_msg => "Resource '$1' is started on node '$2'");
} }
} elsif ($line =~ /\s*([0-9a-zA-Z_\-]+)\s+\(\S+\)\:\s+Stopped/) { $self->{output}->output_add(long_msg => "Resource '$1' is started on node '$2'");
} elsif ($line =~ /\s*([0-9a-zA-Z_\-]+)\s+\(\S+\)\:\s+Stopped/ || $line =~ /\s*([0-9a-zA-Z_\-]+)\s+\(\S+\)\:\s+\(\S+\)\s+Stopped/) {
$self->{output}->output_add(severity => $self->{threshold}, $self->{output}->output_add(severity => $self->{threshold},
short_msg => "Resource '$1' Stopped"); short_msg => "Resource '$1' is stopped",
long_msg => "Resource '$1' is stopped");
} elsif ($line =~ m/\s*stopped\:\s*\[\s*(.*)\s*\]/i) { } elsif ($line =~ m/\s*stopped\:\s*\[\s*(.*)\s*\]/i) {
# Check Master/Slave stopped # Check Master/Slave stopped
my @stopped = (); my @stopped = ();