diff --git a/hardware/kvm/avocent/acs/6000/snmp/mode/components/psu.pm b/hardware/kvm/avocent/acs/6000/snmp/mode/components/psu.pm index d64ae8273..9e8994891 100644 --- a/hardware/kvm/avocent/acs/6000/snmp/mode/components/psu.pm +++ b/hardware/kvm/avocent/acs/6000/snmp/mode/components/psu.pm @@ -33,32 +33,41 @@ my $oid_acsPowerSupply = '.1.3.6.1.4.1.10418.16.2.1.8'; sub load { my ($self) = @_; - + push @{$self->{request}}, { oid => $oid_acsPowerSupply }; } sub check_psu { my ($self, %options) = @_; - + return if ($self->check_filter(section => 'psu', instance => $options{instance})); return if ($options{state} eq 'powerNotInstalled' && $self->absent_problem(section => 'psu', instance => $options{instance})); $self->{components}->{psu}->{total}++; - $self->{output}->output_add(long_msg => sprintf("power supply '%s' status is %s.", - $options{instance}, $options{state} - )); + $self->{output}->output_add( + long_msg => sprintf( + "power supply '%s' status is %s.", + $options{instance}, $options{state} + ) + ); + my $exit = $self->get_severity(section => 'psu', value => $options{state}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Power supply '%s' status is %s", - $options{instance}, $options{state})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Power supply '%s' status is %s", + $options{instance}, + $options{state} + ) + ); } } sub check { my ($self) = @_; - + $self->{output}->output_add(long_msg => "Checking power supplies"); $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; return if ($self->check_filter(section => 'psu')); @@ -68,4 +77,4 @@ sub check { check_psu($self, state => $result->{acsPowerSupplyStatePw2}, instance => '2'); } -1; \ No newline at end of file +1; diff --git a/hardware/kvm/avocent/acs/6000/snmp/mode/hardware.pm b/hardware/kvm/avocent/acs/6000/snmp/mode/hardware.pm index 4b92bb5ff..d8f24ca3a 100644 --- a/hardware/kvm/avocent/acs/6000/snmp/mode/hardware.pm +++ b/hardware/kvm/avocent/acs/6000/snmp/mode/hardware.pm @@ -27,26 +27,26 @@ use warnings; sub set_system { my ($self, %options) = @_; - + $self->{regexp_threshold_overload_check_section_option} = '^(psu)$'; - + $self->{cb_hook2} = 'snmp_execute'; - + $self->{thresholds} = { psu => [ ['statePowerOn', 'OK'], ['statePowerOff', 'CRITICAL'], - ['powerNotInstalled', 'OK'], - ], + ['powerNotInstalled', 'OK'] + ] }; - + $self->{components_path} = 'hardware::kvm::avocent::acs::6000::snmp::mode::components'; $self->{components_module} = ['psu']; } sub snmp_execute { my ($self, %options) = @_; - + $self->{snmp} = $options{snmp}; $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); } @@ -55,10 +55,9 @@ sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1); bless $self, $class; - - $options{options}->add_options(arguments => - { - }); + + $options{options}->add_options(arguments => { + }); return $self; } @@ -101,4 +100,4 @@ Example: --threshold-overload='psu,CRITICAL,^(?!(statePowerOn)$)' =back -=cut \ No newline at end of file +=cut diff --git a/hardware/kvm/avocent/acs/8000/snmp/mode/components/psu.pm b/hardware/kvm/avocent/acs/8000/snmp/mode/components/psu.pm index cc79ec0a1..c17cb32d4 100644 --- a/hardware/kvm/avocent/acs/8000/snmp/mode/components/psu.pm +++ b/hardware/kvm/avocent/acs/8000/snmp/mode/components/psu.pm @@ -27,38 +27,48 @@ my %map_states = (1 => 'statePowerOn', 2 => 'statePowerOff', 9999 => 'powerNotIn my $mapping = { acsPowerSupplyStatePw1 => { oid => '.1.3.6.1.4.1.10418.26.2.1.8.2', map => \%map_states }, - acsPowerSupplyStatePw2 => { oid => '.1.3.6.1.4.1.10418.26.2.1.8.3', map => \%map_states }, + acsPowerSupplyStatePw2 => { oid => '.1.3.6.1.4.1.10418.26.2.1.8.3', map => \%map_states } }; my $oid_acsPowerSupply = '.1.3.6.1.4.1.10418.26.2.1.8'; sub load { my ($self) = @_; - + push @{$self->{request}}, { oid => $oid_acsPowerSupply }; } sub check_psu { my ($self, %options) = @_; - + return if ($self->check_filter(section => 'psu', instance => $options{instance})); return if ($options{state} eq 'powerNotInstalled' && $self->absent_problem(section => 'psu', instance => $options{instance})); $self->{components}->{psu}->{total}++; - $self->{output}->output_add(long_msg => sprintf("power supply '%s' status is %s.", - $options{instance}, $options{state} - )); + $self->{output}->output_add( + long_msg => sprintf( + "power supply '%s' status is %s.", + $options{instance}, + $options{state} + ) + ); + my $exit = $self->get_severity(section => 'psu', value => $options{state}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Power supply '%s' status is %s", - $options{instance}, $options{state})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Power supply '%s' status is %s", + $options{instance}, + $options{state} + ) + ); } } sub check { my ($self) = @_; - + $self->{output}->output_add(long_msg => "Checking power supplies"); $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; return if ($self->check_filter(section => 'psu')); @@ -68,4 +78,4 @@ sub check { check_psu($self, state => $result->{acsPowerSupplyStatePw2}, instance => '2'); } -1; \ No newline at end of file +1; diff --git a/hardware/kvm/avocent/acs/8000/snmp/mode/hardware.pm b/hardware/kvm/avocent/acs/8000/snmp/mode/hardware.pm index 9eabd07b3..8a3283d75 100644 --- a/hardware/kvm/avocent/acs/8000/snmp/mode/hardware.pm +++ b/hardware/kvm/avocent/acs/8000/snmp/mode/hardware.pm @@ -27,17 +27,17 @@ use warnings; sub set_system { my ($self, %options) = @_; - + $self->{regexp_threshold_overload_check_section_option} = '^(psu)$'; - + $self->{cb_hook2} = 'snmp_execute'; - + $self->{thresholds} = { psu => [ ['statePowerOn', 'OK'], ['statePowerOff', 'CRITICAL'], - ['powerNotInstalled', 'OK'], - ], + ['powerNotInstalled', 'OK'] + ] }; $self->{components_path} = 'hardware::kvm::avocent::acs::8000::snmp::mode::components'; @@ -55,10 +55,9 @@ sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_performance => 1); bless $self, $class; - - $options{options}->add_options(arguments => - { - }); + + $options{options}->add_options(arguments => { + }); return $self; } @@ -101,4 +100,4 @@ Example: --threshold-overload='psu,CRITICAL,^(?!(statePowerOn)$)' =back -=cut \ No newline at end of file +=cut