add separator option for --manage-returns
This commit is contained in:
parent
ac30ba1223
commit
3ff05ca7ad
|
@ -44,6 +44,7 @@ sub new {
|
||||||
"command-path:s" => { name => 'command_path' },
|
"command-path:s" => { name => 'command_path' },
|
||||||
"command-options:s" => { name => 'command_options' },
|
"command-options:s" => { name => 'command_options' },
|
||||||
"manage-returns:s" => { name => 'manage_returns', default => '' },
|
"manage-returns:s" => { name => 'manage_returns', default => '' },
|
||||||
|
"separator:s" => { name => 'separator', default => '#' },
|
||||||
});
|
});
|
||||||
$self->{manage_returns} = {};
|
$self->{manage_returns} = {};
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -58,7 +59,7 @@ sub check_options {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $entry (split(/#/, $self->{option_results}->{manage_returns})) {
|
foreach my $entry (split(/$self->{option_results}->{separator}/, $self->{option_results}->{manage_returns})) {
|
||||||
next if (!($entry =~ /(.*?),(.*?),(.*)/));
|
next if (!($entry =~ /(.*?),(.*?),(.*)/));
|
||||||
next if (!$self->{output}->is_litteral_status(status => $2));
|
next if (!$self->{output}->is_litteral_status(status => $2));
|
||||||
if ($1 ne '') {
|
if ($1 ne '') {
|
||||||
|
@ -122,6 +123,10 @@ Check command returns.
|
||||||
Set action according command exit code.
|
Set action according command exit code.
|
||||||
Example: 0,OK,File xxx exist#1,CRITICAL,File xxx not exist#,UNKNOWN,Command problem
|
Example: 0,OK,File xxx exist#1,CRITICAL,File xxx not exist#,UNKNOWN,Command problem
|
||||||
|
|
||||||
|
=item B<--separator>
|
||||||
|
|
||||||
|
Set the separator used in --manage-returns (default : #)
|
||||||
|
|
||||||
=item B<--remote>
|
=item B<--remote>
|
||||||
|
|
||||||
Execute command remotely in 'ssh'.
|
Execute command remotely in 'ssh'.
|
||||||
|
|
|
@ -44,6 +44,7 @@ sub new {
|
||||||
"command-path:s" => { name => 'command_path' },
|
"command-path:s" => { name => 'command_path' },
|
||||||
"command-options:s" => { name => 'command_options' },
|
"command-options:s" => { name => 'command_options' },
|
||||||
"manage-returns:s" => { name => 'manage_returns', default => '' },
|
"manage-returns:s" => { name => 'manage_returns', default => '' },
|
||||||
|
"separator:s" => { name => 'separator', default => '#' },
|
||||||
});
|
});
|
||||||
$self->{manage_returns} = {};
|
$self->{manage_returns} = {};
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -58,7 +59,7 @@ sub check_options {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $entry (split(/#/, $self->{option_results}->{manage_returns})) {
|
foreach my $entry (split(/$self->{option_results}->{separator}/, $self->{option_results}->{manage_returns})) {
|
||||||
next if (!($entry =~ /(.*?),(.*?),(.*)/));
|
next if (!($entry =~ /(.*?),(.*?),(.*)/));
|
||||||
next if (!$self->{output}->is_litteral_status(status => $2));
|
next if (!$self->{output}->is_litteral_status(status => $2));
|
||||||
if ($1 ne '') {
|
if ($1 ne '') {
|
||||||
|
@ -122,6 +123,10 @@ Check command returns.
|
||||||
Set action according command exit code.
|
Set action according command exit code.
|
||||||
Example: 0,OK,File xxx exist#1,CRITICAL,File xxx not exist#,UNKNOWN,Command problem
|
Example: 0,OK,File xxx exist#1,CRITICAL,File xxx not exist#,UNKNOWN,Command problem
|
||||||
|
|
||||||
|
=item B<--separator>
|
||||||
|
|
||||||
|
Set the separator used in --manage-returns (default : #)
|
||||||
|
|
||||||
=item B<--remote>
|
=item B<--remote>
|
||||||
|
|
||||||
Execute command remotely in 'ssh'.
|
Execute command remotely in 'ssh'.
|
||||||
|
|
Loading…
Reference in New Issue