mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 16:45:04 +02:00
add(core): new option --change-exit (#3261)
This commit is contained in:
parent
8109b9b0cd
commit
efe07294fd
@ -42,6 +42,7 @@ sub new {
|
|||||||
'change-perfdata:s@' => { name => 'change_perfdata' },
|
'change-perfdata:s@' => { name => 'change_perfdata' },
|
||||||
'extend-perfdata:s@' => { name => 'extend_perfdata' },
|
'extend-perfdata:s@' => { name => 'extend_perfdata' },
|
||||||
'extend-perfdata-group:s@'=> { name => 'extend_perfdata_group' },
|
'extend-perfdata-group:s@'=> { name => 'extend_perfdata_group' },
|
||||||
|
'change-exit:s@' => { name => 'change_exit' },
|
||||||
'change-short-output:s@' => { name => 'change_short_output' },
|
'change-short-output:s@' => { name => 'change_short_output' },
|
||||||
'use-new-perfdata' => { name => 'use_new_perfdata' },
|
'use-new-perfdata' => { name => 'use_new_perfdata' },
|
||||||
'filter-uom:s' => { name => 'filter_uom' },
|
'filter-uom:s' => { name => 'filter_uom' },
|
||||||
@ -122,6 +123,16 @@ sub check_options {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{change_exit})) {
|
||||||
|
$self->{change_exit} = {};
|
||||||
|
foreach (@{$self->{option_results}->{change_exit}}) {
|
||||||
|
my ($src, $dst) = split(/=/);
|
||||||
|
next if (!defined($src) || !defined($self->{errors}->{ uc($src) }));
|
||||||
|
next if (!defined($dst) || !defined($self->{errors}->{ uc($dst) }));
|
||||||
|
$self->{change_exit}->{uc($src)} = uc($dst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (defined($self->{option_results}->{explode_perfdata_max})) {
|
if (defined($self->{option_results}->{explode_perfdata_max})) {
|
||||||
if (${$self->{option_results}->{explode_perfdata_max}}[0] eq '') {
|
if (${$self->{option_results}->{explode_perfdata_max}}[0] eq '') {
|
||||||
$self->{explode_perfdata_total} = 2;
|
$self->{explode_perfdata_total} = 2;
|
||||||
@ -642,10 +653,17 @@ sub exit {
|
|||||||
if ($self->{noexit_die} == 1) {
|
if ($self->{noexit_die} == 1) {
|
||||||
die 'exit';
|
die 'exit';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $exit;
|
||||||
if (defined($options{exit_litteral})) {
|
if (defined($options{exit_litteral})) {
|
||||||
exit $self->{errors}->{uc($options{exit_litteral})};
|
$exit = uc($options{exit_litteral});
|
||||||
|
} else {
|
||||||
|
$exit = $self->{myerrors}->{ $self->{global_status} };
|
||||||
}
|
}
|
||||||
exit $self->{errors}->{$self->{myerrors}->{$self->{global_status}}};
|
if (defined($self->{change_exit}) && defined($self->{change_exit}->{$exit})) {
|
||||||
|
$exit = $self->{change_exit}->{$exit};
|
||||||
|
}
|
||||||
|
exit $self->{errors}->{$exit};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_option {
|
sub get_option {
|
||||||
@ -1527,7 +1545,11 @@ Sum traffic by interface: --extend-perfdata-group='traffic_in_(.*),traffic_$1,su
|
|||||||
|
|
||||||
=item B<--change-short-output>
|
=item B<--change-short-output>
|
||||||
|
|
||||||
Change short output display. --change-short-output=pattern~replace~modifier
|
Change short output display: --change-short-output=pattern~replace~modifier
|
||||||
|
|
||||||
|
=item B<--change-exit>
|
||||||
|
|
||||||
|
Change exit code: --change-exit=unknown=critical
|
||||||
|
|
||||||
=item B<--range-perfdata>
|
=item B<--range-perfdata>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user