From e21d205ff646ea4440fccf2754e2e3ffc714f2d0 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 1 Dec 2016 17:12:29 +0100 Subject: [PATCH] + Fix #417 --- .../hp/proliant/snmp/mode/components/cpu.pm | 8 +- .../hp/proliant/snmp/mode/components/daacc.pm | 12 +- .../hp/proliant/snmp/mode/components/dactl.pm | 12 +- .../proliant/snmp/mode/components/daldrive.pm | 10 +- .../proliant/snmp/mode/components/dapdrive.pm | 11 +- .../hp/proliant/snmp/mode/components/fan.pm | 10 +- .../snmp/mode/components/fcaexternalacc.pm | 12 +- .../snmp/mode/components/fcaexternalctl.pm | 12 +- .../snmp/mode/components/fcahostctl.pm | 10 +- .../snmp/mode/components/fcaldrive.pm | 10 +- .../snmp/mode/components/fcapdrive.pm | 11 +- .../proliant/snmp/mode/components/idectl.pm | 10 +- .../snmp/mode/components/ideldrive.pm | 8 +- .../snmp/mode/components/idepdrive.pm | 10 +- .../hp/proliant/snmp/mode/components/ilo.pm | 96 +++ .../hp/proliant/snmp/mode/components/lnic.pm | 11 +- .../hp/proliant/snmp/mode/components/pc.pm | 10 +- .../hp/proliant/snmp/mode/components/pnic.pm | 12 +- .../hp/proliant/snmp/mode/components/psu.pm | 12 +- .../proliant/snmp/mode/components/sasctl.pm | 10 +- .../snmp/mode/components/sasldrive.pm | 8 +- .../snmp/mode/components/saspdrive.pm | 10 +- .../proliant/snmp/mode/components/scsictl.pm | 12 +- .../snmp/mode/components/scsildrive.pm | 9 +- .../snmp/mode/components/scsipdrive.pm | 11 +- .../snmp/mode/components/temperature.pm | 8 +- .../server/hp/proliant/snmp/mode/hardware.pm | 561 +++++------------- 27 files changed, 368 insertions(+), 548 deletions(-) create mode 100644 hardware/server/hp/proliant/snmp/mode/components/ilo.pm diff --git a/hardware/server/hp/proliant/snmp/mode/components/cpu.pm b/hardware/server/hp/proliant/snmp/mode/components/cpu.pm index 8207baa0e..73d00169c 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/cpu.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/cpu.pm @@ -41,9 +41,9 @@ my $mapping = { my $oid_cpqSeCpuEntry = '.1.3.6.1.4.1.232.1.2.2.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqSeCpuEntry, start => $mapping->{cpqSeCpuSlot}->{oid}, end => $mapping->{cpqSeCpuSocketNumber}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqSeCpuEntry, start => $mapping->{cpqSeCpuSlot}->{oid}, end => $mapping->{cpqSeCpuSocketNumber}->{oid} }; } sub check { @@ -51,14 +51,14 @@ sub check { $self->{output}->output_add(long_msg => "Checking cpu"); $self->{components}->{cpu} = {name => 'cpus', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'cpu')); + return if ($self->check_filter(section => 'cpu')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSeCpuEntry}})) { next if ($oid !~ /^$mapping->{cpqSeCpuStatus}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSeCpuEntry}, instance => $instance); - next if ($self->check_exclude(section => 'cpu', instance => $instance)); + next if ($self->check_filter(section => 'cpu', instance => $instance)); $self->{components}->{cpu}->{total}++; $self->{output}->output_add(long_msg => sprintf("cpu '%s' [slot: %s, unit: %s, name: %s, socket: %s] status is %s.", diff --git a/hardware/server/hp/proliant/snmp/mode/components/daacc.pm b/hardware/server/hp/proliant/snmp/mode/components/daacc.pm index c3b60c6b8..6a4dfb0ea 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/daacc.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/daacc.pm @@ -60,11 +60,9 @@ my $oid_cpqDaAccelBattery = '.1.3.6.1.4.1.232.3.2.2.2.1.6'; my $oid_cpqDaAccelCondition = '.1.3.6.1.4.1.232.3.2.2.2.1.9'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqDaAccelStatus }; - push @{$options{request}}, { oid => $oid_cpqDaAccelBattery }; - push @{$options{request}}, { oid => $oid_cpqDaAccelCondition }; + push @{$self->{request}}, { oid => $oid_cpqDaAccelStatus }, { oid => $oid_cpqDaAccelBattery }, { oid => $oid_cpqDaAccelCondition }; } sub check { @@ -72,7 +70,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking da accelerator boards"); $self->{components}->{daacc} = {name => 'da accelerator boards', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'daacc')); + return if ($self->check_filter(section => 'daacc')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaAccelCondition}})) { next if ($oid !~ /^$mapping3->{cpqDaAccelCondition}->{oid}\.(.*)$/); @@ -81,13 +79,13 @@ sub check { my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaAccelBattery}, instance => $instance); my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$oid_cpqDaAccelCondition}, instance => $instance); - next if ($self->check_exclude(section => 'daacc', instance => $instance)); + next if ($self->check_filter(section => 'daacc', instance => $instance)); $self->{components}->{daacc}->{total}++; $self->{output}->output_add(long_msg => sprintf("da controller accelerator '%s' [status: %s, battery status: %s] condition is %s.", $instance, $result->{cpqDaAccelStatus}, $result2->{cpqDaAccelBattery}, $result3->{cpqDaAccelCondition})); - my $exit = $self->get_severity(section => 'daacc', value => $result3->{cpqDaAccelCondition}); + my $exit = $self->get_severity(label => 'default', section => 'daacc', value => $result3->{cpqDaAccelCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("da controller accelerator '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/dactl.pm b/hardware/server/hp/proliant/snmp/mode/components/dactl.pm index 488589be8..c44365007 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/dactl.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/dactl.pm @@ -86,10 +86,10 @@ my $oid_cpqDaCntlrEntry = '.1.3.6.1.4.1.232.3.2.2.1.1'; my $oid_cpqDaCntlrModel = '.1.3.6.1.4.1.232.3.2.2.1.1.2'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqDaCntlrEntry, start => $mapping2->{cpqDaCntlrSlot}->{oid}, end => $mapping2->{cpqDaCntlrCondition}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqDaCntlrModel }; + push @{$self->{request}}, { oid => $oid_cpqDaCntlrEntry, start => $mapping2->{cpqDaCntlrSlot}->{oid}, end => $mapping2->{cpqDaCntlrCondition}->{oid} }, + { oid => $oid_cpqDaCntlrModel }; } sub check { @@ -97,7 +97,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking da controller"); $self->{components}->{dactl} = {name => 'da controllers', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'dactl')); + return if ($self->check_filter(section => 'dactl')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaCntlrEntry}})) { next if ($oid !~ /^$mapping2->{cpqDaCntlrCondition}->{oid}\.(.*)$/); @@ -105,13 +105,13 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaCntlrModel}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaCntlrEntry}, instance => $instance); - next if ($self->check_exclude(section => 'dactl', instance => $instance)); + next if ($self->check_filter(section => 'dactl', instance => $instance)); $self->{components}->{dactl}->{total}++; $self->{output}->output_add(long_msg => sprintf("da controller '%s' [slot: %s, model: %s] status is %s.", $instance, $result2->{cpqDaCntlrSlot}, $result->{cpqDaCntlrModel}, $result2->{cpqDaCntlrCondition})); - my $exit = $self->get_severity(section => 'dactl', value => $result2->{cpqDaCntlrCondition}); + my $exit = $self->get_severity(label => 'default', section => 'dactl', value => $result2->{cpqDaCntlrCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("da controller '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/daldrive.pm b/hardware/server/hp/proliant/snmp/mode/components/daldrive.pm index 08b8c0d2d..ca06e2151 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/daldrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/daldrive.pm @@ -69,10 +69,10 @@ my $oid_cpqDaLogDrvEntry = '.1.3.6.1.4.1.232.3.2.3.1.1'; my $oid_cpqDaLogDrvCondition = '.1.3.6.1.4.1.232.3.2.3.1.1.11'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqDaLogDrvEntry, start => $mapping->{cpqDaLogDrvFaultTol}->{oid}, end => $mapping->{cpqDaLogDrvStatus}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqDaLogDrvCondition }; + push @{$self->{request}}, { oid => $oid_cpqDaLogDrvEntry, start => $mapping->{cpqDaLogDrvFaultTol}->{oid}, end => $mapping->{cpqDaLogDrvStatus}->{oid} }, + { oid => $oid_cpqDaLogDrvCondition }; } sub check { @@ -80,7 +80,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking da logical drives"); $self->{components}->{daldrive} = {name => 'da logical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'daldrive')); + return if ($self->check_filter(section => 'daldrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaLogDrvCondition}})) { next if ($oid !~ /^$mapping2->{cpqDaLogDrvCondition}->{oid}\.(.*)$/); @@ -88,7 +88,7 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaLogDrvEntry}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaLogDrvCondition}, instance => $instance); - next if ($self->check_exclude(section => 'daldrive', instance => $instance)); + next if ($self->check_filter(section => 'daldrive', instance => $instance)); $self->{components}->{daldrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("da logical drive '%s' [fault tolerance: %s, condition: %s] status is %s.", diff --git a/hardware/server/hp/proliant/snmp/mode/components/dapdrive.pm b/hardware/server/hp/proliant/snmp/mode/components/dapdrive.pm index 4cfe535c4..7cff8e735 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/dapdrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/dapdrive.pm @@ -49,10 +49,9 @@ my $oid_cpqDaPhyDrvCondition = '.1.3.6.1.4.1.232.3.2.5.1.1.37'; my $oid_cpqDaPhyDrvStatus = '.1.3.6.1.4.1.232.3.2.5.1.1.6'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqDaPhyDrvStatus }; - push @{$options{request}}, { oid => $oid_cpqDaPhyDrvCondition }; + push @{$self->{request}}, { oid => $oid_cpqDaPhyDrvStatus }, { oid => $oid_cpqDaPhyDrvCondition }; } sub check { @@ -60,7 +59,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking da physical drives"); $self->{components}->{dapdrive} = {name => 'da physical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'dapdrive')); + return if ($self->check_filter(section => 'dapdrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaPhyDrvCondition}})) { next if ($oid !~ /^$mapping2->{cpqDaPhyDrvCondition}->{oid}\.(.*)$/); @@ -68,14 +67,14 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaPhyDrvStatus}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaPhyDrvCondition}, instance => $instance); - next if ($self->check_exclude(section => 'dapdrive', instance => $instance)); + next if ($self->check_filter(section => 'dapdrive', instance => $instance)); $self->{components}->{dapdrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("da physical drive '%s' [status: %s] condition is %s.", $instance, $result->{cpqDaPhyDrvStatus}, $result2->{cpqDaPhyDrvCondition})); - my $exit = $self->get_severity(section => 'dapdrive', value => $result2->{cpqDaPhyDrvCondition}); + my $exit = $self->get_severity(label => 'default', section => 'dapdrive', value => $result2->{cpqDaPhyDrvCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("da physical drive '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/fan.pm b/hardware/server/hp/proliant/snmp/mode/components/fan.pm index 29bfe845a..f3202b03c 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/fan.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fan.pm @@ -78,9 +78,9 @@ my $mapping = { my $oid_cpqHeFltTolFanEntry = '.1.3.6.1.4.1.232.6.2.6.7.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqHeFltTolFanEntry, start => $mapping->{cpqHeFltTolFanLocale}->{oid}, end => $mapping->{cpqHeFltTolFanCurrentSpeed}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqHeFltTolFanEntry, start => $mapping->{cpqHeFltTolFanLocale}->{oid}, end => $mapping->{cpqHeFltTolFanCurrentSpeed}->{oid} }; } sub check { @@ -89,14 +89,14 @@ sub check { $self->{output}->output_add(long_msg => "Checking fans"); $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'fan')); + return if ($self->check_filter(section => 'fan')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHeFltTolFanEntry}})) { next if ($oid !~ /^$mapping->{cpqHeFltTolFanCondition}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHeFltTolFanEntry}, instance => $instance); - next if ($self->check_exclude(section => 'fan', instance => $instance)); + next if ($self->check_filter(section => 'fan', instance => $instance)); next if ($result->{cpqHeFltTolFanPresent} !~ /present/i && $self->absent_problem(section => 'fan', instance => $instance)); $self->{components}->{fan}->{total}++; @@ -106,7 +106,7 @@ sub check { $result->{cpqHeFltTolFanLocale}, $result->{cpqHeFltTolFanRedundant}, $result->{cpqHeFltTolFanRedundantPartner} )); - my $exit = $self->get_severity(section => 'fan', value => $result->{cpqHeFltTolFanCondition}); + my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{cpqHeFltTolFanCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("fan '%s' status is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/fcaexternalacc.pm b/hardware/server/hp/proliant/snmp/mode/components/fcaexternalacc.pm index 1eca01e41..26ca971f9 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/fcaexternalacc.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fcaexternalacc.pm @@ -60,11 +60,9 @@ my $oid_cpqFcaAccelCondition = '.1.3.6.1.4.1.232.16.2.2.2.1.9'; my $oid_cpqFcaAccelBatteryStatus = '.1.3.6.1.4.1.232.16.2.2.2.1.6'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqFcaAccelStatus }; - push @{$options{request}}, { oid => $oid_cpqFcaAccelCondition }; - push @{$options{request}}, { oid => $oid_cpqFcaAccelBatteryStatus }; + push @{$self->{request}}, { oid => $oid_cpqFcaAccelStatus }, { oid => $oid_cpqFcaAccelCondition }, { oid => $oid_cpqFcaAccelBatteryStatus }; } sub check { @@ -72,7 +70,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking fca external accelerator boards"); $self->{components}->{fcaexternalacc} = {name => 'fca external accelerator boards', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'fcaexternalacc')); + return if ($self->check_filter(section => 'fcaexternalacc')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaAccelCondition}})) { next if ($oid !~ /^$mapping->{cpqFcaAccelCondition}->{oid}\.(.*)$/); @@ -81,14 +79,14 @@ sub check { my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaAccelCondition}, instance => $instance); my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$oid_cpqFcaAccelBatteryStatus}, instance => $instance); - next if ($self->check_exclude(section => 'fcaexternalacc', instance => $instance)); + next if ($self->check_filter(section => 'fcaexternalacc', instance => $instance)); $self->{components}->{fcaexternalacc}->{total}++; $self->{output}->output_add(long_msg => sprintf("fca external accelerator boards '%s' [status: %s, battery status: %s] condition is %s.", $instance, $result->{cpqFcaAccelStatus}, $result3->{cpqFcaAccelBatteryStatus}, $result2->{cpqFcaAccelCondition})); - my $exit = $self->get_severity(section => 'fcaexternalacc', value => $result2->{cpqFcaAccelCondition}); + my $exit = $self->get_severity(label => 'default', section => 'fcaexternalacc', value => $result2->{cpqFcaAccelCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("fca external accelerator boards '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/fcaexternalctl.pm b/hardware/server/hp/proliant/snmp/mode/components/fcaexternalctl.pm index f21cb36fc..73d7c9c41 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/fcaexternalctl.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fcaexternalctl.pm @@ -71,10 +71,10 @@ my $oid_cpqFcaCntlrEntry = '.1.3.6.1.4.1.232.16.2.2.1.1'; my $oid_cpqFcaCntlrCurrentRole = '.1.3.6.1.4.1.232.16.2.2.1.1.10'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqFcaCntlrEntry, start => $mapping->{cpqFcaCntlrModel}->{oid}, end => $mapping->{cpqFcaCntlrCondition}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqFcaCntlrCurrentRole }; + push @{$self->{request}}, { oid => $oid_cpqFcaCntlrEntry, start => $mapping->{cpqFcaCntlrModel}->{oid}, end => $mapping->{cpqFcaCntlrCondition}->{oid} }, + { oid => $oid_cpqFcaCntlrCurrentRole }; } sub check { @@ -82,7 +82,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking fca external controller"); $self->{components}->{fcaexternalctl} = {name => 'fca external controllers', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'fcaexternalctl')); + return if ($self->check_filter(section => 'fcaexternalctl')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaCntlrEntry}})) { next if ($oid !~ /^$mapping->{cpqFcaCntlrCondition}->{oid}\.(.*)$/); @@ -90,14 +90,14 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaCntlrEntry}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaCntlrCurrentRole}, instance => $instance); - next if ($self->check_exclude(section => 'fcaexternalctl', instance => $instance)); + next if ($self->check_filter(section => 'fcaexternalctl', instance => $instance)); $self->{components}->{fcaexternalctl}->{total}++; $self->{output}->output_add(long_msg => sprintf("fca external controller '%s' [model: %s, status: %s, role: %s] condition is %s.", $instance, $result->{cpqFcaCntlrModel}, $result->{cpqFcaCntlrStatus}, $result2->{cpqFcaCntlrCurrentRole}, $result->{cpqFcaCntlrCondition})); - my $exit = $self->get_severity(section => 'fcaexternalctl', value => $result->{cpqFcaCntlrCondition}); + my $exit = $self->get_severity(label => 'default', section => 'fcaexternalctl', value => $result->{cpqFcaCntlrCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("fca external controller '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/fcahostctl.pm b/hardware/server/hp/proliant/snmp/mode/components/fcahostctl.pm index def3ab6d3..89a741206 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/fcahostctl.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fcahostctl.pm @@ -90,9 +90,9 @@ my $mapping = { my $oid_cpqFcaHostCntlrEntry = '.1.3.6.1.4.1.232.16.2.7.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqFcaHostCntlrEntry, start => $mapping->{cpqFcaHostCntlrSlot}->{oid}, end => $mapping->{cpqFcaHostCntlrCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqFcaHostCntlrEntry, start => $mapping->{cpqFcaHostCntlrSlot}->{oid}, end => $mapping->{cpqFcaHostCntlrCondition}->{oid} }; } sub check { @@ -100,20 +100,20 @@ sub check { $self->{output}->output_add(long_msg => "Checking fca host controller"); $self->{components}->{fcahostctl} = {name => 'fca host controllers', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'fcahostctl')); + return if ($self->check_filter(section => 'fcahostctl')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaHostCntlrEntry}})) { next if ($oid !~ /^$mapping->{cpqFcaHostCntlrCondition}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaHostCntlrEntry}, instance => $instance); - next if ($self->check_exclude(section => 'fcahostctl', instance => $instance)); + next if ($self->check_filter(section => 'fcahostctl', instance => $instance)); $self->{components}->{fcahostctl}->{total}++; $self->{output}->output_add(long_msg => sprintf("fca host controller '%s' [slot: %s, model: %s, status: %s] condition is %s.", $instance, $result->{cpqFcaHostCntlrSlot}, $result->{cpqFcaHostCntlrModel}, $result->{cpqFcaHostCntlrStatus}, $result->{cpqFcaHostCntlrCondition})); - my $exit = $self->get_severity(section => 'fcahostctl', value => $result->{cpqFcaHostCntlrCondition}); + my $exit = $self->get_severity(label => 'default', section => 'fcahostctl', value => $result->{cpqFcaHostCntlrCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("fca host controller '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/fcaldrive.pm b/hardware/server/hp/proliant/snmp/mode/components/fcaldrive.pm index e01302d36..bd9268bdd 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/fcaldrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fcaldrive.pm @@ -69,10 +69,10 @@ my $oid_cpqFcaLogDrvEntry = '.1.3.6.1.4.1.232.16.2.3.1.1'; my $oid_cpqFcaLogDrvCondition = '.1.3.6.1.4.1.232.16.2.3.1.1.11'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqFcaLogDrvEntry, start => $mapping->{cpqFcaLogDrvFaultTol}->{oid}, end => $mapping->{cpqFcaLogDrvStatus}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqFcaLogDrvCondition }; + push @{$self->{request}}, { oid => $oid_cpqFcaLogDrvEntry, start => $mapping->{cpqFcaLogDrvFaultTol}->{oid}, end => $mapping->{cpqFcaLogDrvStatus}->{oid} }, + { oid => $oid_cpqFcaLogDrvCondition }; } sub check { @@ -80,7 +80,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking fca logical drives"); $self->{components}->{fcaldrive} = {name => 'fca logical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'fcaldrive')); + return if ($self->check_filter(section => 'fcaldrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaLogDrvCondition}})) { next if ($oid !~ /^$mapping2->{cpqFcaLogDrvCondition}->{oid}\.(.*)$/); @@ -88,7 +88,7 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaLogDrvEntry}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaLogDrvCondition}, instance => $instance); - next if ($self->check_exclude(section => 'fcaldrive', instance => $instance)); + next if ($self->check_filter(section => 'fcaldrive', instance => $instance)); $self->{components}->{fcaldrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("fca logical drive '%s' [fault tolerance: %s, condition: %s] status is %s.", diff --git a/hardware/server/hp/proliant/snmp/mode/components/fcapdrive.pm b/hardware/server/hp/proliant/snmp/mode/components/fcapdrive.pm index ef13fbbb0..d527bef8a 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/fcapdrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/fcapdrive.pm @@ -52,10 +52,9 @@ my $oid_cpqFcaPhyDrvCondition = '.1.3.6.1.4.1.232.16.2.5.1.1.31'; my $oid_cpqFcaPhyDrvStatus = '.1.3.6.1.4.1.232.16.2.5.1.1.6'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqFcaPhyDrvCondition }; - push @{$options{request}}, { oid => $oid_cpqFcaPhyDrvStatus }; + push @{$self->{request}}, { oid => $oid_cpqFcaPhyDrvCondition }, { oid => $oid_cpqFcaPhyDrvStatus }; } sub check { @@ -63,7 +62,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking fca physical drives"); $self->{components}->{fcapdrive} = {name => 'fca physical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'fcapdrive')); + return if ($self->check_filter(section => 'fcapdrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaPhyDrvCondition}})) { next if ($oid !~ /^$mapping2->{cpqFcaPhyDrvCondition}->{oid}\.(.*)$/); @@ -71,14 +70,14 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaPhyDrvStatus}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaPhyDrvCondition}, instance => $instance); - next if ($self->check_exclude(section => 'fcapdrive', instance => $instance)); + next if ($self->check_filter(section => 'fcapdrive', instance => $instance)); $self->{components}->{fcapdrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("fca physical drive '%s' [status: %s] condition is %s.", $instance, $result->{cpqFcaPhyDrvStatus}, $result2->{cpqFcaPhyDrvCondition})); - my $exit = $self->get_severity(section => 'fcapdrive', value => $result2->{cpqFcaPhyDrvCondition}); + my $exit = $self->get_severity(label => 'default', section => 'fcapdrive', value => $result2->{cpqFcaPhyDrvCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => short_msg => sprintf("fca physical drive '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/idectl.pm b/hardware/server/hp/proliant/snmp/mode/components/idectl.pm index 900c3c31a..b27dcc388 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/idectl.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/idectl.pm @@ -47,9 +47,9 @@ my $mapping = { my $oid_cpqIdeControllerEntry = '.1.3.6.1.4.1.232.14.2.3.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqIdeControllerEntry, start => $mapping->{cpqIdeControllerModel}->{oid}, end => $mapping->{cpqIdeControllerCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqIdeControllerEntry, start => $mapping->{cpqIdeControllerModel}->{oid}, end => $mapping->{cpqIdeControllerCondition}->{oid} }; } sub check { @@ -57,7 +57,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking ide controllers"); $self->{components}->{idectl} = {name => 'ide controllers', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'idectl')); + return if ($self->check_filter(section => 'idectl')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqIdeControllerEntry}})) { next if ($oid !~ /^$mapping->{cpqIdeControllerCondition}->{oid}\.(.*)$/); @@ -65,13 +65,13 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqIdeControllerEntry}, instance => $instance); $result->{cpqIdeControllerModel} = centreon::plugins::misc::trim($result->{cpqIdeControllerModel}); - next if ($self->check_exclude(section => 'idectl', instance => $instance)); + next if ($self->check_filter(section => 'idectl', instance => $instance)); $self->{components}->{idectl}->{total}++; $self->{output}->output_add(long_msg => sprintf("ide controller '%s' [slot: %s, model: %s, status: %s] condition is %s.", $instance, $result->{cpqIdeControllerSlot}, $result->{cpqIdeControllerModel}, $result->{cpqIdeControllerStatus}, $result->{cpqIdeControllerCondition})); - my $exit = $self->get_severity(section => 'idectl', value => $result->{cpqIdeControllerCondition}); + my $exit = $self->get_severity(label => 'default', section => 'idectl', value => $result->{cpqIdeControllerCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("ide controller '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/ideldrive.pm b/hardware/server/hp/proliant/snmp/mode/components/ideldrive.pm index 765cc1778..b421e48d4 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/ideldrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/ideldrive.pm @@ -47,9 +47,9 @@ my $mapping = { my $oid_cpqIdeLogicalDriveEntry = '.1.3.6.1.4.1.232.14.2.6.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqIdeLogicalDriveEntry, start => $mapping->{cpqIdeLogicalDriveStatus}->{oid}, end => $mapping->{cpqIdeLogicalDriveCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqIdeLogicalDriveEntry, start => $mapping->{cpqIdeLogicalDriveStatus}->{oid}, end => $mapping->{cpqIdeLogicalDriveCondition}->{oid} }; } sub check { @@ -57,14 +57,14 @@ sub check { $self->{output}->output_add(long_msg => "Checking ide logical drives"); $self->{components}->{ideldrive} = {name => 'ide logical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'ideldrive')); + return if ($self->check_filter(section => 'ideldrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqIdeLogicalDriveEntry}})) { next if ($oid !~ /^$mapping->{cpqIdeLogicalDriveCondition}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqIdeLogicalDriveEntry}, instance => $instance); - next if ($self->check_exclude(section => 'ideldrive', instance => $instance)); + next if ($self->check_filter(section => 'ideldrive', instance => $instance)); $self->{components}->{ideldrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("ide logical drive '%s' is %s [condition: %s]", diff --git a/hardware/server/hp/proliant/snmp/mode/components/idepdrive.pm b/hardware/server/hp/proliant/snmp/mode/components/idepdrive.pm index 6a385b4fd..44714edd6 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/idepdrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/idepdrive.pm @@ -46,9 +46,9 @@ my $mapping = { my $oid_cpqIdeAtaDiskEntry = '.1.3.6.1.4.1.232.14.2.4.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqIdeAtaDiskEntry, start => $mapping->{cpqIdeAtaDiskStatus}->{oid}, end => $mapping->{cpqIdeAtaDiskCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqIdeAtaDiskEntry, start => $mapping->{cpqIdeAtaDiskStatus}->{oid}, end => $mapping->{cpqIdeAtaDiskCondition}->{oid} }; } sub check { @@ -56,21 +56,21 @@ sub check { $self->{output}->output_add(long_msg => "Checking ide physical drives"); $self->{components}->{idepdrive} = {name => 'ide physical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'idepdrive')); + return if ($self->check_filter(section => 'idepdrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqIdeAtaDiskEntry}})) { next if ($oid !~ /^$mapping->{cpqIdeAtaDiskCondition}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqIdeAtaDiskEntry}, instance => $instance); - next if ($self->check_exclude(section => 'idepdrive', instance => $instance)); + next if ($self->check_filter(section => 'idepdrive', instance => $instance)); $self->{components}->{idepdrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("ide physical drive '%s' [status: %s] condition is %s.", $instance, $result->{cpqIdeAtaDiskStatus}, $result->{cpqIdeAtaDiskCondition})); - my $exit = $self->get_severity(section => 'idepdrive', value => $result->{cpqIdeAtaDiskCondition}); + my $exit = $self->get_severity(label => 'default', section => 'idepdrive', value => $result->{cpqIdeAtaDiskCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("ide physical drive '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/ilo.pm b/hardware/server/hp/proliant/snmp/mode/components/ilo.pm new file mode 100644 index 000000000..f5cdb85bf --- /dev/null +++ b/hardware/server/hp/proliant/snmp/mode/components/ilo.pm @@ -0,0 +1,96 @@ +# +# Copyright 2016 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package hardware::server::hp::proliant::snmp::mode::components::cpu; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'unknown', + 2 => 'ok', + 3 => 'degraded', + 4 => 'failed', +); +my %map_bitmask_status = ( + 16 => 'I2C error', + 15 => 'EEPROM error', + 14 => 'SRAM error', + 13 => 'CPLD error', + 12 => 'Mouse interface error', + 11 => 'NIC Error', + 10 => 'PCMCIA Error', + 9 => 'Video Error', + 8 => 'NVRAM write/read/verify error', + 7 => 'NVRAM interface error', + 6 => 'Battery interface error', + 5 => 'Keyboard interface error', + 4 => 'Serial port UART error', + 3 => 'Modem UART error', + 2 => 'Modem firmware error', + 1 => 'Memory test error', + 0 => 'Busmaster I/O read error', +); + +# In MIB 'CPQSM2-MIB.mib' +my $mapping = { + cpqSm2MibCondition => { oid => '.1.3.6.1.4.1.232.9.1.3', map => \%map_status }, +}; +my $oid_cpqSm2CntlrSelfTestErrors = '.1.3.6.1.4.1.232.9.2.2.9'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $mapping->{cpqSm2MibCondition}->{oid} }, { oid => $oid_cpqSm2CntlrSelfTestErrors }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking ilo"); + $self->{components}->{ilo} = {name => 'ilo', total => 0, skip => 0}; + return if ($self->check_filter(section => 'ilo')); + + return if (!defined($self->{results}->{$mapping->{cpqSm2MibCondition}->{oid}})); + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{cpqSm2MibCondition}->{oid}}, instance => '0'); + + next if ($self->check_filter(section => 'ilo', instance => $instance)); + $self->{components}->{ilo}->{total}++; + + my @message_error = (); + if (defined($self->{results}->{$oid_cpqSm2CntlrSelfTestErrors}->{$oid_cpqSm2CntlrSelfTestErrors . '.0'})) { + foreach my $bit (keys %{$map_bitmask_status}) { + if (int($self->{results}->{$oid_cpqSm2CntlrSelfTestErrors}->{$oid_cpqSm2CntlrSelfTestErrors . '.0'}) & (1 << ($bit))) { + push @message_error, $map_bitmask_status{$bit}; + } + } + } + + $self->{output}->output_add(long_msg => sprintf("ilo status is %s.", + $instance, $result->{cpqSm2MibCondition})); + my $exit = $self->get_severity(label => 'default', section => 'ilo', value => $result->{cpqSm2MibCondition}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("ilo '%s' is %s", + $instance, $result->{cpqSm2MibCondition})); + } +} + +1; \ No newline at end of file diff --git a/hardware/server/hp/proliant/snmp/mode/components/lnic.pm b/hardware/server/hp/proliant/snmp/mode/components/lnic.pm index 5d6cd0235..8f14d2423 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/lnic.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/lnic.pm @@ -56,11 +56,10 @@ my $oid_cpqNicIfLogMapDescription = '.1.3.6.1.4.1.232.18.2.2.1.1.3'; my $oid_cpqNicIfLogMapAdapterCount = '.1.3.6.1.4.1.232.18.2.2.1.1.5'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqNicIfLogMapEntry, start => $mapping3->{cpqNicIfLogMapCondition}->{oid}, end => $mapping3->{cpqNicIfLogMapStatus}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqNicIfLogMapDescription }; - push @{$options{request}}, { oid => $oid_cpqNicIfLogMapAdapterCount }; + push @{$self->{request}}, { oid => $oid_cpqNicIfLogMapEntry, start => $mapping3->{cpqNicIfLogMapCondition}->{oid}, end => $mapping3->{cpqNicIfLogMapStatus}->{oid} }, + { oid => $oid_cpqNicIfLogMapDescription }, { oid => $oid_cpqNicIfLogMapAdapterCount }; } sub check { @@ -68,7 +67,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking logical nics"); $self->{components}->{lnic} = {name => 'logical nics', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'lnic')); + return if ($self->check_filter(section => 'lnic')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqNicIfLogMapEntry}})) { next if ($oid !~ /^$mapping3->{cpqNicIfLogMapCondition}->{oid}\.(.*)$/); @@ -77,7 +76,7 @@ sub check { my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqNicIfLogMapAdapterCount}, instance => $instance); my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$oid_cpqNicIfLogMapEntry}, instance => $instance); - next if ($self->check_exclude(section => 'lnic', instance => $instance)); + next if ($self->check_filter(section => 'lnic', instance => $instance)); $self->{components}->{lnic}->{total}++; $self->{output}->output_add(long_msg => sprintf("logical nic '%s' [adapter count: %s, description: %s, status: %s] condition is %s.", diff --git a/hardware/server/hp/proliant/snmp/mode/components/pc.pm b/hardware/server/hp/proliant/snmp/mode/components/pc.pm index 95f0c4c9b..bfc620ff0 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/pc.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/pc.pm @@ -52,9 +52,9 @@ my $mapping = { my $oid_cpqHePowerConverterEntry = '.1.3.6.1.4.1.232.6.2.13.3.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqHePowerConverterEntry, start => $mapping->{cpqHePwrConvPresent}->{oid}, end => $mapping->{cpqHePwrConvCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqHePowerConverterEntry, start => $mapping->{cpqHePwrConvPresent}->{oid}, end => $mapping->{cpqHePwrConvCondition}->{oid} }; } sub check { @@ -62,14 +62,14 @@ sub check { $self->{output}->output_add(long_msg => "Checking power converters"); $self->{components}->{pc} = {name => 'power converters', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'pc')); + return if ($self->check_filter(section => 'pc')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHePowerConverterEntry}})) { next if ($oid !~ /^$mapping->{cpqHePwrConvPresent}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHePowerConverterEntry}, instance => $instance); - next if ($self->check_exclude(section => 'pc', instance => $instance)); + next if ($self->check_filter(section => 'pc', instance => $instance)); next if ($result->{cpqHePwrConvPresent} !~ /present/i && $self->absent_problem(section => 'pc', instance => $instance)); @@ -79,7 +79,7 @@ sub check { $instance, $result->{cpqHePwrConvCondition}, $result->{cpqHePwrConvRedundant}, $result->{cpqHePwrConvRedundantGroupId} )); - my $exit = $self->get_severity(section => 'pc', value => $result->{cpqHePwrConvCondition}); + my $exit = $self->get_severity(label => 'default', section => 'pc', value => $result->{cpqHePwrConvCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("powerconverter '%s' status is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/pnic.pm b/hardware/server/hp/proliant/snmp/mode/components/pnic.pm index ec0637ed5..348f0e3f4 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/pnic.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/pnic.pm @@ -71,10 +71,10 @@ my $oid_cpqNicIfPhysAdapterEntry = '.1.3.6.1.4.1.232.18.2.3.1.1'; my $oid_cpqNicIfPhysAdapterRole = '.1.3.6.1.4.1.232.18.2.3.1.1.3'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqNicIfPhysAdapterEntry, start => $mapping2->{cpqNicIfPhysAdapterDuplexState}->{oid}, end => $mapping2->{cpqNicIfPhysAdapterStatus}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqNicIfPhysAdapterRole }; + push @{$self->{request}}, { oid => $oid_cpqNicIfPhysAdapterEntry, start => $mapping2->{cpqNicIfPhysAdapterDuplexState}->{oid}, end => $mapping2->{cpqNicIfPhysAdapterStatus}->{oid} }, + { oid => $oid_cpqNicIfPhysAdapterRole }; } sub check { @@ -82,7 +82,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking physical nics"); $self->{components}->{pnic} = {name => 'physical nics', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'pnic')); + return if ($self->check_filter(section => 'pnic')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqNicIfPhysAdapterEntry}})) { next if ($oid !~ /^$mapping2->{cpqNicIfPhysAdapterCondition}->{oid}\.(.*)$/); @@ -90,14 +90,14 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqNicIfPhysAdapterRole}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqNicIfPhysAdapterEntry}, instance => $instance); - next if ($self->check_exclude(section => 'pnic', instance => $instance)); + next if ($self->check_filter(section => 'pnic', instance => $instance)); $self->{components}->{pnic}->{total}++; $self->{output}->output_add(long_msg => sprintf("physical nic '%s' [duplex: %s, role: %s, state: %s, status: %s] condition is %s.", $instance, $result2->{cpqNicIfPhysAdapterDuplexState}, $result->{cpqNicIfPhysAdapterRole}, $result2->{cpqNicIfPhysAdapterState}, $result2->{cpqNicIfPhysAdapterStatus}, $result2->{cpqNicIfPhysAdapterCondition})); - my $exit = $self->get_severity(section => 'pnic', value => $result2->{cpqNicIfPhysAdapterCondition}); + my $exit = $self->get_severity(label => 'default', section => 'pnic', value => $result2->{cpqNicIfPhysAdapterCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("physical nic '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/psu.pm b/hardware/server/hp/proliant/snmp/mode/components/psu.pm index 5e6a68167..ad7fa9479 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/psu.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/psu.pm @@ -78,10 +78,10 @@ my $oid_cpqHeFltTolPowerSupplyEntry = '.1.3.6.1.4.1.232.6.2.9.3.1'; my $oid_cpqHeFltTolPowerSupplyRedundantPartner = '.1.3.6.1.4.1.232.6.2.9.3.1.17'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqHeFltTolPowerSupplyEntry, start => $mapping->{cpqHeFltTolPowerSupplyPresent}->{oid}, end => $mapping->{cpqHeFltTolPowerSupplyRedundant}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqHeFltTolPowerSupplyRedundantPartner }; + push @{$self->{request}}, { oid => $oid_cpqHeFltTolPowerSupplyEntry, start => $mapping->{cpqHeFltTolPowerSupplyPresent}->{oid}, end => $mapping->{cpqHeFltTolPowerSupplyRedundant}->{oid} }, + { oid => $oid_cpqHeFltTolPowerSupplyRedundantPartner }; } sub check { @@ -89,7 +89,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking power supplies"); $self->{components}->{psu} = {name => 'power supplies', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'psu')); + return if ($self->check_filter(section => 'psu')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHeFltTolPowerSupplyEntry}})) { next if ($oid !~ /^$mapping->{cpqHeFltTolPowerSupplyPresent}->{oid}\.(.*)$/); @@ -97,7 +97,7 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHeFltTolPowerSupplyEntry}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqHeFltTolPowerSupplyRedundantPartner}, instance => $instance); - next if ($self->check_exclude(section => 'psu', instance => $instance)); + next if ($self->check_filter(section => 'psu', instance => $instance)); next if ($result->{cpqHeFltTolPowerSupplyPresent} !~ /present/i && $self->absent_problem(section => 'psu', instance => $instance)); $self->{components}->{psu}->{total}++; @@ -108,7 +108,7 @@ sub check { defined($result2->{cpqHeFltTolPowerSupplyRedundantPartner}) ? $result2->{cpqHeFltTolPowerSupplyRedundantPartner} : 'unknown', $result->{cpqHeFltTolPowerSupplyStatus} )); - my $exit = $self->get_severity(section => 'psu', value => $result->{cpqHeFltTolPowerSupplyCondition}); + my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{cpqHeFltTolPowerSupplyCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("powersupply '%s' status is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/sasctl.pm b/hardware/server/hp/proliant/snmp/mode/components/sasctl.pm index 7d75de032..2f80a1391 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/sasctl.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/sasctl.pm @@ -46,9 +46,9 @@ my $mapping = { my $oid_cpqSasHbaEntry = '.1.3.6.1.4.1.232.5.5.1.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqSasHbaEntry, start => $mapping->{cpqSasHbaStatus}->{oid}, end => $mapping->{cpqSasHbaSlot}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqSasHbaEntry, start => $mapping->{cpqSasHbaStatus}->{oid}, end => $mapping->{cpqSasHbaSlot}->{oid} }; } sub check { @@ -56,20 +56,20 @@ sub check { $self->{output}->output_add(long_msg => "Checking sas controllers"); $self->{components}->{sasctl} = {name => 'sas controllers', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'sasctl')); + return if ($self->check_filter(section => 'sasctl')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSasHbaEntry}})) { next if ($oid !~ /^$mapping->{cpqSasHbaCondition}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSasHbaEntry}, instance => $instance); - next if ($self->check_exclude(section => 'sasctl', instance => $instance)); + next if ($self->check_filter(section => 'sasctl', instance => $instance)); $self->{components}->{sasctl}->{total}++; $self->{output}->output_add(long_msg => sprintf("sas controller '%s' [slot: %s, status: %s] condition is %s.", $instance, $result->{cpqSasHbaSlot}, $result->{cpqSasHbaStatus}, $result->{cpqSasHbaCondition})); - my $exit = $self->get_severity(section => 'sasctl', value => $result->{cpqSasHbaCondition}); + my $exit = $self->get_severity(label => 'default', section => 'sasctl', value => $result->{cpqSasHbaCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("sas controller '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/sasldrive.pm b/hardware/server/hp/proliant/snmp/mode/components/sasldrive.pm index 990fc2ddf..21ae9f2b3 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/sasldrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/sasldrive.pm @@ -47,9 +47,9 @@ my $mapping = { my $oid_cpqSasLogDrvEntry = '.1.3.6.1.4.1.232.5.5.3.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqSasLogDrvEntry, start => $mapping->{cpqSasLogDrvStatus}->{oid}, end => $mapping->{cpqSasLogDrvCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqSasLogDrvEntry, start => $mapping->{cpqSasLogDrvStatus}->{oid}, end => $mapping->{cpqSasLogDrvCondition}->{oid} }; } sub check { @@ -57,14 +57,14 @@ sub check { $self->{output}->output_add(long_msg => "Checking sas logical drives"); $self->{components}->{sasldrive} = {name => 'sas logical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'sasldrive')); + return if ($self->check_filter(section => 'sasldrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSasLogDrvEntry}})) { next if ($oid !~ /^$mapping->{cpqSasLogDrvStatus}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSasLogDrvEntry}, instance => $instance); - next if ($self->check_exclude(section => 'sasldrive', instance => $instance)); + next if ($self->check_filter(section => 'sasldrive', instance => $instance)); $self->{components}->{sasldrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("sas logical drive '%s' status is %s [condition: %s].", diff --git a/hardware/server/hp/proliant/snmp/mode/components/saspdrive.pm b/hardware/server/hp/proliant/snmp/mode/components/saspdrive.pm index 94ae8210d..5cfa907af 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/saspdrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/saspdrive.pm @@ -54,9 +54,9 @@ my $mapping = { my $oid_cpqSasPhyDrvEntry = '.1.3.6.1.4.1.232.5.5.2.1.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqSasPhyDrvEntry, start => $mapping->{cpqSasPhyDrvStatus}->{oid}, end => $mapping->{cpqSasPhyDrvCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqSasPhyDrvEntry, start => $mapping->{cpqSasPhyDrvStatus}->{oid}, end => $mapping->{cpqSasPhyDrvCondition}->{oid} }; } sub check { @@ -64,21 +64,21 @@ sub check { $self->{output}->output_add(long_msg => "Checking sas physical drives"); $self->{components}->{saspdrive} = {name => 'sas physical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'saspdrive')); + return if ($self->check_filter(section => 'saspdrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSasPhyDrvEntry}})) { next if ($oid !~ /^$mapping->{cpqSasPhyDrvCondition}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSasPhyDrvEntry}, instance => $instance); - next if ($self->check_exclude(section => 'saspdrive', instance => $instance)); + next if ($self->check_filter(section => 'saspdrive', instance => $instance)); $self->{components}->{saspdrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("sas physical drive '%s' [status: %s] condition is %s.", $instance, $result->{cpqSasPhyDrvStatus}, $result->{cpqSasPhyDrvCondition})); - my $exit = $self->get_severity(section => 'saspdrive', value => $result->{cpqSasPhyDrvCondition}); + my $exit = $self->get_severity(label => 'default', section => 'saspdrive', value => $result->{cpqSasPhyDrvCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("sas physical drive '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/scsictl.pm b/hardware/server/hp/proliant/snmp/mode/components/scsictl.pm index 163c180c9..b40110798 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/scsictl.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/scsictl.pm @@ -49,10 +49,10 @@ my $oid_cpqScsiCntlrEntry = '.1.3.6.1.4.1.232.5.2.2.1.1'; my $oid_cpqScsiCntlrCondition = '.1.3.6.1.4.1.232.5.2.2.1.1.12'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqScsiCntlrEntry, start => $mapping->{cpqScsiCntlrSlot}->{oid}, end => $mapping->{cpqScsiCntlrStatus}->{oid} }; - push @{$options{request}}, { oid => $oid_cpqScsiCntlrCondition }; + push @{$self->{request}}, { oid => $oid_cpqScsiCntlrEntry, start => $mapping->{cpqScsiCntlrSlot}->{oid}, end => $mapping->{cpqScsiCntlrStatus}->{oid} }, + { oid => $oid_cpqScsiCntlrCondition }; } sub check { @@ -60,7 +60,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking scsi controllers"); $self->{components}->{scsictl} = {name => 'scsi controllers', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'scsictl')); + return if ($self->check_filter(section => 'scsictl')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqScsiCntlrEntry}})) { next if ($oid !~ /^$mapping->{cpqScsiCntlrStatus}->{oid}\.(.*)$/); @@ -68,13 +68,13 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqScsiCntlrEntry}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqScsiCntlrCondition}, instance => $instance); - next if ($self->check_exclude(section => 'scsictl', instance => $instance)); + next if ($self->check_filter(section => 'scsictl', instance => $instance)); $self->{components}->{scsictl}->{total}++; $self->{output}->output_add(long_msg => sprintf("scsi controller '%s' [slot: %s, status: %s] condition is %s.", $instance, $result->{cpqScsiCntlrSlot}, $result->{cpqScsiCntlrStatus}, $result2->{cpqScsiCntlrCondition})); - my $exit = $self->get_severity(section => 'scsictl', value => $result2->{cpqScsiCntlrCondition}); + my $exit = $self->get_severity(label => 'default', section => 'scsictl', value => $result2->{cpqScsiCntlrCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("scsi controller '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/scsildrive.pm b/hardware/server/hp/proliant/snmp/mode/components/scsildrive.pm index 260e3d5a4..50424b844 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/scsildrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/scsildrive.pm @@ -57,10 +57,9 @@ my $oid_cpqScsiLogDrvCondition = '.1.3.6.1.4.1.232.5.2.3.1.1.8'; my $oid_cpqScsiLogDrvStatus = '.1.3.6.1.4.1.232.5.2.3.1.1.5'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqScsiLogDrvStatus }; - push @{$options{request}}, { oid => $oid_cpqScsiLogDrvCondition }; + push @{$self->{request}}, { oid => $oid_cpqScsiLogDrvStatus }, { oid => $oid_cpqScsiLogDrvCondition }; } sub check { @@ -68,7 +67,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking scsi logical drives"); $self->{components}->{scsildrive} = {name => 'scsi logical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'scsildrive')); + return if ($self->check_filter(section => 'scsildrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqScsiLogDrvCondition}})) { next if ($oid !~ /^$mapping2->{cpqScsiLogDrvCondition}->{oid}\.(.*)$/); @@ -76,7 +75,7 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqScsiLogDrvStatus}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqScsiLogDrvCondition}, instance => $instance); - next if ($self->check_exclude(section => 'scsildrive', instance => $instance)); + next if ($self->check_filter(section => 'scsildrive', instance => $instance)); $self->{components}->{scsildrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("scsi logical drive '%s' status is %s [condition: %s].", diff --git a/hardware/server/hp/proliant/snmp/mode/components/scsipdrive.pm b/hardware/server/hp/proliant/snmp/mode/components/scsipdrive.pm index 6787b744a..ff91145b1 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/scsipdrive.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/scsipdrive.pm @@ -58,10 +58,9 @@ my $oid_cpqScsiPhyDrvCondition = '.1.3.6.1.4.1.232.5.2.4.1.1.26'; my $oid_cpqScsiPhyDrvStatus = '.1.3.6.1.4.1.232.5.2.4.1.1.9'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqScsiPhyDrvStatus }; - push @{$options{request}}, { oid => $oid_cpqScsiPhyDrvCondition }; + push @{$self->{request}}, { oid => $oid_cpqScsiPhyDrvStatus }, { oid => $oid_cpqScsiPhyDrvCondition }; } sub check { @@ -69,7 +68,7 @@ sub check { $self->{output}->output_add(long_msg => "Checking scsi physical drives"); $self->{components}->{scsipdrive} = {name => 'scsi physical drives', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'scsipdrive')); + return if ($self->check_filter(section => 'scsipdrive')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqScsiPhyDrvCondition}})) { next if ($oid !~ /^$mapping->{cpqScsiPhyDrvCondition}->{oid}\.(.*)$/); @@ -77,14 +76,14 @@ sub check { my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqScsiPhyDrvStatus}, instance => $instance); my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqScsiPhyDrvCondition}, instance => $instance); - next if ($self->check_exclude(section => 'scsipdrive', instance => $instance)); + next if ($self->check_filter(section => 'scsipdrive', instance => $instance)); $self->{components}->{scsipdrive}->{total}++; $self->{output}->output_add(long_msg => sprintf("scsi physical drive '%s' [status: %s] condition is %s.", $instance, $result->{cpqScsiPhyDrvStatus}, $result2->{cpqScsiPhyDrvCondition})); - my $exit = $self->get_severity(section => 'scsipdrive', value => $result2->{cpqScsiPhyDrvCondition}); + my $exit = $self->get_severity(label => 'default', section => 'scsipdrive', value => $result2->{cpqScsiPhyDrvCondition}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, short_msg => sprintf("scsi physical drive '%s' is %s", diff --git a/hardware/server/hp/proliant/snmp/mode/components/temperature.pm b/hardware/server/hp/proliant/snmp/mode/components/temperature.pm index 3d413efbe..99406c7c8 100644 --- a/hardware/server/hp/proliant/snmp/mode/components/temperature.pm +++ b/hardware/server/hp/proliant/snmp/mode/components/temperature.pm @@ -60,9 +60,9 @@ my $mapping = { my $oid_cpqHeTemperatureEntry = '.1.3.6.1.4.1.232.6.2.6.8.1'; sub load { - my (%options) = @_; + my ($self) = @_; - push @{$options{request}}, { oid => $oid_cpqHeTemperatureEntry, start => $mapping->{cpqHeTemperatureLocale}->{oid}, end => $mapping->{cpqHeTemperatureCondition}->{oid} }; + push @{$self->{request}}, { oid => $oid_cpqHeTemperatureEntry, start => $mapping->{cpqHeTemperatureLocale}->{oid}, end => $mapping->{cpqHeTemperatureCondition}->{oid} }; } sub check { @@ -70,14 +70,14 @@ sub check { $self->{output}->output_add(long_msg => "Checking temperatures"); $self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0}; - return if ($self->check_exclude(section => 'temperature')); + return if ($self->check_filter(section => 'temperature')); foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHeTemperatureEntry}})) { next if ($oid !~ /^$mapping->{cpqHeTemperatureCondition}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHeTemperatureEntry}, instance => $instance); - next if ($self->check_exclude(section => 'temperature', instance => $instance)); + next if ($self->check_filter(section => 'temperature', instance => $instance)); $self->{components}->{temperature}->{total}++; $self->{output}->output_add(long_msg => sprintf("'%s' %s temperature is %dC (%d max) (status is %s).", diff --git a/hardware/server/hp/proliant/snmp/mode/hardware.pm b/hardware/server/hp/proliant/snmp/mode/hardware.pm index b0eb8a6f2..cbeb86685 100644 --- a/hardware/server/hp/proliant/snmp/mode/hardware.pm +++ b/hardware/server/hp/proliant/snmp/mode/hardware.pm @@ -20,213 +20,142 @@ package hardware::server::hp::proliant::snmp::mode::hardware; -use base qw(centreon::plugins::mode); +use base qw(centreon::plugins::templates::hardware); use strict; use warnings; use centreon::plugins::misc; -my $thresholds = { - cpu => [ - ['unknown', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ['disabled', 'OK'], - ], - idectl => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - ideldrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['rebuilding', 'WARNING'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - idepdrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - pc => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - psu => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - sasctl => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - sasldrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['rebuilding', 'WARNING'], - ['failed', 'CRITICAL'], - ['offline', 'CRITICAL'], - ], - saspdrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - scsictl => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - scsildrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ['unconfigured', 'OK'], - ['recovering', 'WARNING'], - ['readyForRebuild', 'WARNING'], - ['rebuilding', 'WARNING'], - ['wrongDrive', 'CRITICAL'], - ['badConnect', 'CRITICAL'], - ['disabled', 'OK'], - ], - scsipdrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - fcahostctl => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - fcaexternalctl => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - fcaexternalacc => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - fcaexternalaccbattery => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ['recharging', 'WARNING'], - ['not present', 'OK'], - ], - fcaldrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['failed', 'CRITICAL'], - ['rebuilding', 'WARNING'], - ['expanding', 'WARNING'], - ['recovering', 'WARNING'], - ['unconfigured', 'OK'], - ['readyForRebuild', 'WARNING'], - ['wrongDrive', 'CRITICAL'], - ['badConnect', 'CRITICAL'], - ['overheating', 'CRITICAL'], - ['notAvailable', 'WARNING'], - ['hardError', 'CRITICAL'], - ['queuedForExpansion', 'WARNING'], - ['shutdown', 'WARNING'], - ], - fcapdrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - dactl => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - daacc => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - daaccbattery => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ['recharging', 'WARNING'], - ['not present', 'OK'], - ], - daldrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['failed', 'CRITICAL'], - ['rebuilding', 'WARNING'], - ['expanding', 'WARNING'], - ['recovering', 'WARNING'], - ['unconfigured', 'OK'], - ['readyForRebuild', 'WARNING'], - ['wrongDrive', 'CRITICAL'], - ['badConnect', 'CRITICAL'], - ['overheating', 'CRITICAL'], - ['notAvailable', 'WARNING'], - ['hardError', 'CRITICAL'], - ['queuedForExpansion', 'WARNING'], - ['shutdown', 'WARNING'], - ], - dapdrive => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - fan => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - pnic => [ - ['other', 'UNKNOWN'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - lnic => [ - ['other', 'OK'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], - temperature => [ - ['other', 'OK'], - ['ok', 'OK'], - ['degraded', 'WARNING'], - ['failed', 'CRITICAL'], - ], -}; +sub set_system { + my ($self, %options) = @_; + + $self->{regexp_threshold_overload_check_section_option} = + '^(ilo|cpu|idectl|ideldrive|idepdrive|pc|psu|sasctl|sasldrive|saspdrive|scsictl|scsildrive|scsipdrive|fcahostctl|fcaexternalctl|fcaexternalacc|fcaldrive|fcapdrive|dactl|daacc|daldrive|dapdrive|fan|pnic|lnic|temperature)$'; + $self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$'; + + $self->{cb_hook1} = 'get_system_information'; + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + cpu => [ + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ['disabled', 'OK'], + ], + ideldrive => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['rebuilding', 'WARNING'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ], + sasldrive => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['rebuilding', 'WARNING'], + ['failed', 'CRITICAL'], + ['offline', 'CRITICAL'], + ], + scsildrive => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ['unconfigured', 'OK'], + ['recovering', 'WARNING'], + ['readyForRebuild', 'WARNING'], + ['rebuilding', 'WARNING'], + ['wrongDrive', 'CRITICAL'], + ['badConnect', 'CRITICAL'], + ['disabled', 'OK'], + ], + fcaexternalaccbattery => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ['recharging', 'WARNING'], + ['not present', 'OK'], + ], + fcaldrive => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['failed', 'CRITICAL'], + ['rebuilding', 'WARNING'], + ['expanding', 'WARNING'], + ['recovering', 'WARNING'], + ['unconfigured', 'OK'], + ['readyForRebuild', 'WARNING'], + ['wrongDrive', 'CRITICAL'], + ['badConnect', 'CRITICAL'], + ['overheating', 'CRITICAL'], + ['notAvailable', 'WARNING'], + ['hardError', 'CRITICAL'], + ['queuedForExpansion', 'WARNING'], + ['shutdown', 'WARNING'], + ], + daaccbattery => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ['recharging', 'WARNING'], + ['not present', 'OK'], + ], + daldrive => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['failed', 'CRITICAL'], + ['rebuilding', 'WARNING'], + ['expanding', 'WARNING'], + ['recovering', 'WARNING'], + ['unconfigured', 'OK'], + ['readyForRebuild', 'WARNING'], + ['wrongDrive', 'CRITICAL'], + ['badConnect', 'CRITICAL'], + ['overheating', 'CRITICAL'], + ['notAvailable', 'WARNING'], + ['hardError', 'CRITICAL'], + ['queuedForExpansion', 'WARNING'], + ['shutdown', 'WARNING'], + ], + lnic => [ + ['other', 'OK'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ], + temperature => [ + ['other', 'OK'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ], + # ilo, pnic, fan, dapdrive, daacc, dactl, fcapdrive, fcaexternalacc, fcaexternalctl, fcahostctl, scsipdrive, scsictl, saspdrive, sasctl, psu, pc, idepdrive, idectl + default => [ + ['other', 'UNKNOWN'], + ['ok', 'OK'], + ['degraded', 'WARNING'], + ['failed', 'CRITICAL'], + ], + }; + + $self->{components_path} = 'hardware::server::hp::proliant::snmp::mode::components'; + $self->{components_module} = ['cpu', 'idectl', 'ideldrive', 'idepdrive', 'pc', 'psu', + 'sasctl', 'sasldrive', 'saspdrive', 'scsictl', 'scsildrive', 'scsipdrive', + 'fcahostctl', 'fcaexternalctl', 'fcaexternalacc', 'fcaldrive', 'fcapdrive', + 'dactl', 'daacc', 'daldrive', 'dapdrive', 'fan', 'pnic', 'lnic', 'temperature', 'ilo']; +} + +sub snmp_execute { + my ($self, %options) = @_; + + $self->{snmp} = $options{snmp}; + $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); +} sub new { my ($class, %options) = @_; @@ -235,76 +164,16 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => - { - "exclude:s" => { name => 'exclude' }, - "absent-problem:s" => { name => 'absent' }, - "component:s" => { name => 'component', default => '.*' }, - "no-component:s" => { name => 'no_component' }, - "threshold-overload:s@" => { name => 'threshold_overload' }, - "warning:s@" => { name => 'warning' }, - "critical:s@" => { name => 'critical' }, + { }); - - $self->{product_name} = undef; - $self->{serial} = undef; - $self->{romversion} = undef; - $self->{components} = {}; - $self->{no_components} = undef; return $self; } sub check_options { my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (defined($self->{option_results}->{no_component})) { - if ($self->{option_results}->{no_component} ne '') { - $self->{no_components} = $self->{option_results}->{no_component}; - } else { - $self->{no_components} = 'critical'; - } - } - - $self->{overload_th} = {}; - foreach my $val (@{$self->{option_results}->{threshold_overload}}) { - if ($val !~ /^(.*?),(.*?),(.*)$/) { - $self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'."); - $self->{output}->option_exit(); - } - my ($section, $status, $filter) = ($1, $2, $3); - if ($self->{output}->is_litteral_status(status => $status) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'."); - $self->{output}->option_exit(); - } - $self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section})); - push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status}; - } - - $self->{numeric_threshold} = {}; - foreach my $option (('warning', 'critical')) { - foreach my $val (@{$self->{option_results}->{$option}}) { - if ($val !~ /^(.*?),(.*?),(.*)$/) { - $self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'."); - $self->{output}->option_exit(); - } - my ($section, $regexp, $value) = ($1, $2, $3); - if ($section !~ /(temperature)/) { - $self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: temperature)."); - $self->{output}->option_exit(); - } - my $position = 0; - if (defined($self->{numeric_threshold}->{$section})) { - $position = scalar(@{$self->{numeric_threshold}->{$section}}); - } - if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'."); - $self->{output}->option_exit(); - } - $self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section})); - push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp }; - } - } + $self->SUPER::check_options(%options); + if ($self->{option_results}->{component} =~ /storage/i) { $self->{option_results}->{component} = '^(sas|ide|fca|da|scsi).*'; } @@ -313,158 +182,22 @@ sub check_options { } } -sub run { - my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - - $self->get_system_information(); - $self->{output}->output_add(long_msg => sprintf("Product Name: %s, Serial: %s, Rom Version: %s", - $self->{product_name}, $self->{serial}, $self->{romversion}) - ); - - my $snmp_request = []; - my @components = ('cpu', 'idectl', 'ideldrive', 'idepdrive', 'pc', 'psu', - 'sasctl', 'sasldrive', 'saspdrive', 'scsictl', 'scsildrive', 'scsipdrive', - 'fcahostctl', 'fcaexternalctl', 'fcaexternalacc', 'fcaldrive', 'fcapdrive', - 'dactl', 'daacc', 'daldrive', 'dapdrive', 'fan', 'pnic', 'lnic', 'temperature'); - foreach (@components) { - if (/$self->{option_results}->{component}/) { - my $mod_name = "hardware::server::hp::proliant::snmp::mode::components::$_"; - centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name, - error_msg => "Cannot load module '$mod_name'."); - my $func = $mod_name->can('load'); - $func->(request => $snmp_request); - } - } - - if (scalar(@{$snmp_request}) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); - $self->{output}->option_exit(); - } - $self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request); - - foreach (@components) { - if (/$self->{option_results}->{component}/) { - my $mod_name = "hardware::server::hp::proliant::snmp::mode::components::$_"; - my $func = $mod_name->can('check'); - $func->($self); - } - } - - my $total_components = 0; - my $display_by_component = ''; - my $display_by_component_append = ''; - foreach my $comp (sort(keys %{$self->{components}})) { - # Skipping short msg when no components - next if ($self->{components}->{$comp}->{total} == 0 && $self->{components}->{$comp}->{skip} == 0); - $total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip}; - my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip}; - $display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name}; - $display_by_component_append = ', '; - } - - $self->{output}->output_add(severity => 'OK', - short_msg => sprintf("All %s components are ok [%s].", - $total_components, - $display_by_component) - ); - - if (defined($self->{option_results}->{no_component}) && $total_components == 0) { - $self->{output}->output_add(severity => $self->{no_components}, - short_msg => 'No components are checked.'); - } - - $self->{output}->display(); - $self->{output}->exit(); -} - sub get_system_information { - my ($self) = @_; + my ($self, %options) = @_; # In 'CPQSINFO-MIB' my $oid_cpqSiSysSerialNum = ".1.3.6.1.4.1.232.2.2.2.1.0"; my $oid_cpqSiProductName = ".1.3.6.1.4.1.232.2.2.4.2.0"; my $oid_cpqSeSysRomVer = ".1.3.6.1.4.1.232.1.2.6.1.0"; - my $result = $self->{snmp}->get_leef(oids => [$oid_cpqSiSysSerialNum, $oid_cpqSiProductName, $oid_cpqSeSysRomVer]); + my $result = $options{snmp}->get_leef(oids => [$oid_cpqSiSysSerialNum, $oid_cpqSiProductName, $oid_cpqSeSysRomVer]); - $self->{product_name} = defined($result->{$oid_cpqSiProductName}) ? centreon::plugins::misc::trim($result->{$oid_cpqSiProductName}) : 'unknown'; - $self->{serial} = defined($result->{$oid_cpqSiSysSerialNum}) ? centreon::plugins::misc::trim($result->{$oid_cpqSiSysSerialNum}) : 'unknown'; - $self->{romversion} = defined($result->{$oid_cpqSeSysRomVer}) ? centreon::plugins::misc::trim($result->{$oid_cpqSeSysRomVer}) : 'unknown'; -} - -sub check_exclude { - my ($self, %options) = @_; - - if (defined($options{instance})) { - if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) { - $self->{components}->{$options{section}}->{skip}++; - $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance.")); - return 1; - } - } elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) { - $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section.")); - return 1; - } - return 0; -} - -sub absent_problem { - my ($self, %options) = @_; - - if (defined($self->{option_results}->{absent}) && - $self->{option_results}->{absent} =~ /(^|\s|,)($options{section}(\s*,|$)|${options{section}}[^,]*#\Q$options{instance}\E#)/) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => sprintf("Component '%s' instance '%s' is not present", - $options{section}, $options{instance})); - } - - $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance (not present)")); - $self->{components}->{$options{section}}->{skip}++; - return 1; -} - -sub get_severity_numeric { - my ($self, %options) = @_; - my $status = 'OK'; # default - my $thresholds = { warning => undef, critical => undef }; - my $checked = 0; - - if (defined($self->{numeric_threshold}->{$options{section}})) { - my $exits = []; - foreach (@{$self->{numeric_threshold}->{$options{section}}}) { - if ($options{instance} =~ /$_->{regexp}/) { - push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]); - $thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label}); - $checked = 1; - } - } - $status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0); - } - - return ($status, $thresholds->{warning}, $thresholds->{critical}, $checked); -} - -sub get_severity { - my ($self, %options) = @_; - my $status = 'UNKNOWN'; # default - - if (defined($self->{overload_th}->{$options{section}})) { - foreach (@{$self->{overload_th}->{$options{section}}}) { - if ($options{value} =~ /$_->{filter}/i) { - $status = $_->{status}; - return $status; - } - } - } - foreach (@{$thresholds->{$options{section}}}) { - if ($options{value} =~ /$$_[0]/i) { - $status = $$_[1]; - return $status; - } - } - - return $status; + my $product_name = defined($result->{$oid_cpqSiProductName}) ? centreon::plugins::misc::trim($result->{$oid_cpqSiProductName}) : 'unknown'; + my $serial = defined($result->{$oid_cpqSiSysSerialNum}) ? centreon::plugins::misc::trim($result->{$oid_cpqSiSysSerialNum}) : 'unknown'; + my $romversion = defined($result->{$oid_cpqSeSysRomVer}) ? centreon::plugins::misc::trim($result->{$oid_cpqSeSysRomVer}) : 'unknown'; + $self->{output}->output_add(long_msg => sprintf("Product Name: %s, Serial: %s, Rom Version: %s", + $product_name, $serial, $romversion) + ); } 1; @@ -483,15 +216,15 @@ Which component to check (Default: '.*'). Can be: 'cpu', 'psu', 'pc', 'fan', 'temperature', 'lnic', 'pnic',... There are some magic words like: 'network', 'storage'. -=item B<--exclude> +=item B<--filter> -Exclude some parts (comma seperated list) (Example: --exclude=fan,cpu) -Can also exclude specific instance: --exclude=fan#1.2#,lnic#1#,cpu +Exclude some parts (comma seperated list) (Example: --filter=fan --filter=temperature) +Can also exclude specific instance: --filter=fan,1.2 --filter=lnic,1 =item B<--absent-problem> -Return an error if an entity is not 'present' (default is skipping) (comma seperated list) -Can be specific or global: --absent-problem=fan#1.2#,cpu +Return an error if an entity is not 'present' (default is skipping +Can be specific or global: --absent-problem=fan,1.2 =item B<--no-component>