From 8fcbec2d5ec0943011f3b892cd20ce41bda08b2d Mon Sep 17 00:00:00 2001 From: Sims24 Date: Mon, 5 Oct 2015 12:12:53 +0200 Subject: [PATCH 1/3] +Few fix on plugin help Add error-id option description Specify verbose instead of description (didn't work) --- centreon-plugins/os/aix/local/mode/errpt.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/centreon-plugins/os/aix/local/mode/errpt.pm b/centreon-plugins/os/aix/local/mode/errpt.pm index 0308c1a26..b5d20c7d2 100644 --- a/centreon-plugins/os/aix/local/mode/errpt.pm +++ b/centreon-plugins/os/aix/local/mode/errpt.pm @@ -213,13 +213,17 @@ Filter error type separated by a coma (INFO, PEND, PERF, PERM, TEMP, UNKN). Filter error class ('H' for hardware, 'S' for software, '0' for errlogger, 'U' for undetermined). +=item B<--error-id> + +Filter specific error code + =item B<--retention> Retention time of errors in seconds. -=item B<--description> +=item B<--verbose> -Print error description in output. +Print error description in long output. [ Error 'CODE' Date: Timestamp ResourceName: RsrcName Description: Desc ] =item B<--filter-resource> From e394365d2c1f890d71a75802cf41a142e0cffbba Mon Sep 17 00:00:00 2001 From: Sims24 Date: Mon, 5 Oct 2015 12:48:47 +0200 Subject: [PATCH 2/3] +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 From 2785bee8084bc75e1280e6215d2965d7965ef9c6 Mon Sep 17 00:00:00 2001 From: Sims24 Date: Mon, 5 Oct 2015 13:00:15 +0200 Subject: [PATCH 3/3] +Fix bug "unitialized value in sprintf" Probably here since retention management has been introduced. Now it's better --- centreon-plugins/os/aix/local/mode/errpt.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/centreon-plugins/os/aix/local/mode/errpt.pm b/centreon-plugins/os/aix/local/mode/errpt.pm index dd2b0c278..de064cf27 100644 --- a/centreon-plugins/os/aix/local/mode/errpt.pm +++ b/centreon-plugins/os/aix/local/mode/errpt.pm @@ -139,7 +139,7 @@ sub run { $self->manage_selection(); $self->{output}->output_add(severity => 'OK', - short_msg => sprintf("No error found since %s seconds%s.", $extra_message)); + short_msg => sprintf("No error found%s.", $extra_message)); my $total_error = 0; foreach my $errpt_error (sort(keys %{$self->{result}})) {