From aeb31bbc3355ad0e0a667500acb2e5370537e96e Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Mon, 18 May 2015 21:03:50 +0200 Subject: [PATCH] + enhance mode hardware iDrac: work now with iDrac 6 also Thanks Gilum!! Still need to work on iDrac 8 to have more detailed information (mode hardware) --- .../dell/idrac/snmp/mode/globalstatus.pm | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hardware/server/dell/idrac/snmp/mode/globalstatus.pm b/hardware/server/dell/idrac/snmp/mode/globalstatus.pm index 6db7c0e25..563069482 100644 --- a/hardware/server/dell/idrac/snmp/mode/globalstatus.pm +++ b/hardware/server/dell/idrac/snmp/mode/globalstatus.pm @@ -72,17 +72,24 @@ sub run { # $options{snmp} = snmp object $self->{snmp} = $options{snmp}; + my $oid_drsGlobalSystemStatus = '.1.3.6.1.4.1.674.10892.2.2.1.0'; my $oid_globalSystemStatus = '.1.3.6.1.4.1.674.10892.5.2.1.0'; my $oid_globalStorageStatus = '.1.3.6.1.4.1.674.10892.5.2.3.0'; - my $result = $self->{snmp}->get_leef(oids => [$oid_globalSystemStatus, $oid_globalStorageStatus], nothing_quit => 1); + my $result = $self->{snmp}->get_leef(oids => [$oid_drsGlobalSystemStatus, $oid_globalSystemStatus, $oid_globalStorageStatus], nothing_quit => 1); - $self->{output}->output_add(severity => ${$states{$result->{$oid_globalSystemStatus}}}[1], - short_msg => sprintf("Overall global status is '%s'", - ${$states{$result->{$oid_globalSystemStatus}}}[0])); - $self->{output}->output_add(severity => ${$states{$result->{$oid_globalStorageStatus}}}[1], - short_msg => sprintf("Overall storage status is '%s'", - ${$states{$result->{$oid_globalStorageStatus}}}[0])); - + # iDrac 6 + if (defined($result->{$oid_drsGlobalSystemStatus})) { + $self->{output}->output_add(severity => ${$states{$result->{$oid_drsGlobalSystemStatus}}}[1], + short_msg => sprintf("Overall global status is '%s'", + ${$states{$result->{$oid_drsGlobalSystemStatus}}}[0])); + } else { # iDrac > 6 + $self->{output}->output_add(severity => ${$states{$result->{$oid_globalSystemStatus}}}[1], + short_msg => sprintf("Overall global status is '%s'", + ${$states{$result->{$oid_globalSystemStatus}}}[0])); + $self->{output}->output_add(severity => ${$states{$result->{$oid_globalStorageStatus}}}[1], + short_msg => sprintf("Overall storage status is '%s'", + ${$states{$result->{$oid_globalStorageStatus}}}[0])); + } $self->{output}->display(); $self->{output}->exit(); }