Merge pull request #179 from Sims24/master
Enhance os::aix::local::mode::errpt mode and fix minor bug
This commit is contained in:
commit
e1e4d57e13
|
@ -46,10 +46,12 @@ sub new {
|
||||||
"command-options:s" => { name => 'command_options', default => '' },
|
"command-options:s" => { name => 'command_options', default => '' },
|
||||||
"error-type:s" => { name => 'error_type' },
|
"error-type:s" => { name => 'error_type' },
|
||||||
"error-class:s" => { name => 'error_class' },
|
"error-class:s" => { name => 'error_class' },
|
||||||
|
"error-id:s" => { name => 'error_id' },
|
||||||
"retention:s" => { name => 'retention' },
|
"retention:s" => { name => 'retention' },
|
||||||
"timezone:s" => { name => 'timezone' },
|
"timezone:s" => { name => 'timezone' },
|
||||||
"description" => { name => 'description' },
|
"description" => { name => 'description' },
|
||||||
"filter-resource:s" => { name => 'filter_resource' },
|
"filter-resource:s" => { name => 'filter_resource' },
|
||||||
|
"exclude-id:s" => { name => 'exclude_id' },
|
||||||
});
|
});
|
||||||
$self->{result} = {};
|
$self->{result} = {};
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -58,6 +60,11 @@ sub new {
|
||||||
sub check_options {
|
sub check_options {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
$self->SUPER::init(%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 {
|
sub manage_selection {
|
||||||
|
@ -70,6 +77,12 @@ sub manage_selection {
|
||||||
if (defined($self->{option_results}->{error_class})){
|
if (defined($self->{option_results}->{error_class})){
|
||||||
$extra_options .= ' -d '.$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 ''){
|
if (defined($self->{option_results}->{retention}) && $self->{option_results}->{retention} ne ''){
|
||||||
my $retention = time() - $self->{option_results}->{retention};
|
my $retention = time() - $self->{option_results}->{retention};
|
||||||
if (defined($self->{option_results}->{timezone})){
|
if (defined($self->{option_results}->{timezone})){
|
||||||
|
@ -126,7 +139,7 @@ sub run {
|
||||||
|
|
||||||
$self->manage_selection();
|
$self->manage_selection();
|
||||||
$self->{output}->output_add(severity => 'OK',
|
$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;
|
my $total_error = 0;
|
||||||
foreach my $errpt_error (sort(keys %{$self->{result}})) {
|
foreach my $errpt_error (sort(keys %{$self->{result}})) {
|
||||||
|
@ -213,18 +226,26 @@ 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).
|
Filter error class ('H' for hardware, 'S' for software, '0' for errlogger, 'U' for undetermined).
|
||||||
|
|
||||||
|
=item B<--error-id>
|
||||||
|
|
||||||
|
Filter specific error code (can be a comma separated list).
|
||||||
|
|
||||||
=item B<--retention>
|
=item B<--retention>
|
||||||
|
|
||||||
Retention time of errors in seconds.
|
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>
|
=item B<--filter-resource>
|
||||||
|
|
||||||
Filter resource (can use a regexp).
|
Filter resource (can use a regexp).
|
||||||
|
|
||||||
|
=item B<--exclude-id>
|
||||||
|
|
||||||
|
Filter on specific error code (can be a comma separated list).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
Loading…
Reference in New Issue