Merge remote branch 'projet_original_master/master'

This commit is contained in:
yann beulque 2015-08-21 09:48:41 +02:00
commit de21f060ee
2 changed files with 10 additions and 2 deletions

View File

@ -41,6 +41,7 @@ sub new {
"filter-perfdata:s" => { name => 'filter_perfdata' }, "filter-perfdata:s" => { name => 'filter_perfdata' },
"change-perfdata:s@" => { name => 'change_perfdata' }, "change-perfdata:s@" => { name => 'change_perfdata' },
"verbose" => { name => 'verbose' }, "verbose" => { name => 'verbose' },
"debug" => { name => 'debug' },
"opt-exit:s" => { name => 'opt_exit', default => 'unknown' }, "opt-exit:s" => { name => 'opt_exit', default => 'unknown' },
"output-xml" => { name => 'output_xml' }, "output-xml" => { name => 'output_xml' },
"output-json" => { name => 'output_json' }, "output-json" => { name => 'output_json' },
@ -156,6 +157,7 @@ sub output_add {
my %args = ( my %args = (
severity => 'OK', severity => 'OK',
separator => ' - ', separator => ' - ',
debug => 0,
short_msg => undef, short_msg => undef,
long_msg => undef long_msg => undef
); );
@ -172,7 +174,8 @@ sub output_add {
push @{$self->{global_short_outputs}->{uc($options->{severity})}}, $options->{short_msg}; push @{$self->{global_short_outputs}->{uc($options->{severity})}}, $options->{short_msg};
$self->set_status(exit_litteral => $options->{severity}); $self->set_status(exit_litteral => $options->{severity});
} }
if (defined($options->{long_msg})) { if (defined($options->{long_msg}) &&
($options->{debug} == 0 || defined($self->{option_results}->{debug}))) {
chomp $options->{long_msg}; chomp $options->{long_msg};
push @{$self->{global_long_output}}, $options->{long_msg}; push @{$self->{global_long_output}}, $options->{long_msg};
} }
@ -427,6 +430,7 @@ sub display {
my $nolabel = defined($options{nolabel}) ? 1 : 0; my $nolabel = defined($options{nolabel}) ? 1 : 0;
my $force_ignore_perfdata = (defined($options{force_ignore_perfdata}) && $options{force_ignore_perfdata} == 1) ? 1 : 0; my $force_ignore_perfdata = (defined($options{force_ignore_perfdata}) && $options{force_ignore_perfdata} == 1) ? 1 : 0;
my $force_long_output = (defined($options{force_long_output}) && $options{force_long_output} == 1) ? 1 : 0; my $force_long_output = (defined($options{force_long_output}) && $options{force_long_output} == 1) ? 1 : 0;
$force_long_output = 1 if (defined($self->{option_results}->{debug}));
if (defined($self->{option_results}->{output_xml})) { if (defined($self->{option_results}->{output_xml})) {
$self->create_xml_document(); $self->create_xml_document();
@ -748,6 +752,10 @@ Output class
Display long output. Display long output.
=item B<--debug>
Display also debug messages.
=item B<--filter-perfdata> =item B<--filter-perfdata>
Filter perfdata that match the regexp. Filter perfdata that match the regexp.

View File

@ -252,7 +252,7 @@ sub manage_selection {
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}, instance => $instance); my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}, instance => $instance);
if (defined($self->{option_results}->{filter_domain}) && $self->{option_results}->{filter_domain} ne '' && if (defined($self->{option_results}->{filter_domain}) && $self->{option_results}->{filter_domain} ne '' &&
$instance !~ /$self->{option_results}->{filter_domain}/) { $instance !~ /$self->{option_results}->{filter_domain}/) {
$self->{output}->output_add(long_msg => "Skipping '" . $instance . "': no matching filter."); $self->{output}->output_add(long_msg => "Skipping '" . $instance . "': no matching filter.", debug => 1);
next; next;
} }