From e394365d2c1f890d71a75802cf41a142e0cffbba Mon Sep 17 00:00:00 2001 From: Sims24 Date: Mon, 5 Oct 2015 12:48:47 +0200 Subject: [PATCH] +Add error-id inclusion/exclustion management Mapping between --error-id and --exclude-id options and errpt AIX options -j and -k --- centreon-plugins/os/aix/local/mode/errpt.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/centreon-plugins/os/aix/local/mode/errpt.pm b/centreon-plugins/os/aix/local/mode/errpt.pm index b5d20c7d2..dd2b0c278 100644 --- a/centreon-plugins/os/aix/local/mode/errpt.pm +++ b/centreon-plugins/os/aix/local/mode/errpt.pm @@ -46,10 +46,12 @@ sub new { "command-options:s" => { name => 'command_options', default => '' }, "error-type:s" => { name => 'error_type' }, "error-class:s" => { name => 'error_class' }, + "error-id:s" => { name => 'error_id' }, "retention:s" => { name => 'retention' }, "timezone:s" => { name => 'timezone' }, "description" => { name => 'description' }, - "filter-resource:s" => { name => 'filter_resource' }, + "filter-resource:s" => { name => 'filter_resource' }, + "exclude-id:s" => { name => 'exclude_id' }, }); $self->{result} = {}; return $self; @@ -58,6 +60,11 @@ sub new { sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); + + if (defined($self->{option_results}->{exclude_id}) && defined($self->{option_results}->{error_id})) { + $self->{output}->add_option_msg(short_msg => "Please use --error-id OR --exclude-id, these options are mutually exclusives"); + $self->{output}->option_exit(); + } } sub manage_selection { @@ -70,6 +77,12 @@ sub manage_selection { if (defined($self->{option_results}->{error_class})){ $extra_options .= ' -d '.$self->{option_results}->{error_class}; } + if (defined($self->{option_results}->{error_id}) && $self->{option_results}->{error_id} ne ''){ + $extra_options.= ' -j '.$self->{option_results}->{error_id}; + } + if (defined($self->{option_results}->{exclude_id}) && $self->{option_results}->{exclude_id} ne ''){ + $extra_options.= ' -k '.$self->{option_results}->{exclude_id}; + } if (defined($self->{option_results}->{retention}) && $self->{option_results}->{retention} ne ''){ my $retention = time() - $self->{option_results}->{retention}; if (defined($self->{option_results}->{timezone})){ @@ -215,7 +228,7 @@ Filter error class ('H' for hardware, 'S' for software, '0' for errlogger, 'U' f =item B<--error-id> -Filter specific error code +Filter specific error code (can be a comma separated list). =item B<--retention> @@ -229,6 +242,10 @@ Print error description in long output. [ Error 'CODE' Date: Timestamp ResourceN Filter resource (can use a regexp). +=item B<--exclude-id> + +Filter on specific error code (can be a comma separated list). + =back =cut