Fix on exclude option #5151

This commit is contained in:
Kevin Duret 2014-01-31 15:16:00 +01:00
parent 21607ef4b2
commit cce3a97146
1 changed files with 6 additions and 4 deletions

View File

@ -40,10 +40,10 @@ use base qw(centreon::plugins::mode);
use strict; use strict;
use warnings; use warnings;
use centreon::plugins::misc; use centreon::plugins::misc;
use hardware::server::dell::openmanage::mode::components::globalstatus;
use hardware::server::dell::openmanage::mode::components::fan; use hardware::server::dell::openmanage::mode::components::fan;
use hardware::server::dell::openmanage::mode::components::psu; use hardware::server::dell::openmanage::mode::components::psu;
use hardware::server::dell::openmanage::mode::components::temperature; use hardware::server::dell::openmanage::mode::components::temperature;
use hardware::server::dell::openmanage::mode::components::globalstatus;
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
@ -53,7 +53,7 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"exclude" => { name => 'exclude' }, "exclude:s" => { name => 'exclude' },
}); });
$self->{product_name} = undef; $self->{product_name} = undef;
@ -81,6 +81,8 @@ sub run {
my $display_by_component = ''; my $display_by_component = '';
my $display_by_component_append = ''; my $display_by_component_append = '';
foreach my $comp (keys %{$self->{components}}) { foreach my $comp (keys %{$self->{components}}) {
# Skipping short msg when no components
next if ($self->{components}->{$comp}->{total} == 0);
$total_components += $self->{components}->{$comp}->{total}; $total_components += $self->{components}->{$comp}->{total};
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . ' ' . $self->{components}->{$comp}->{name}; $display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . ' ' . $self->{components}->{$comp}->{name};
$display_by_component_append = ', '; $display_by_component_append = ', ';
@ -123,13 +125,13 @@ __END__
=head1 MODE =head1 MODE
Check Hardware (CPUs, Power Supplies, Power converters, Fans). Check Hardware (Fans, Power Supplies, Temperature Probes).
=over 8 =over 8
=item B<--exclude> =item B<--exclude>
Exclude some parts (comma seperated list) (Example: --exclude=psu,pc). Exclude some parts (comma seperated list) (Example: --exclude=psu,fan).
=back =back