From daf3654e58bb85b593d4f5ea7bae79d6a183fe10 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 28 May 2019 22:00:20 +0200 Subject: [PATCH] update changelog --- changelog | 1 + hardware/pdu/eaton/snmp/mode/group.pm | 6 +++++- hardware/pdu/eaton/snmp/mode/outlet.pm | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/changelog b/changelog index e7130dc5c..ac3352158 100644 --- a/changelog +++ b/changelog @@ -11,6 +11,7 @@ * Enhancement: [haproxy/snmp] manage oss mib (#1475) * Enhancement: [oracle] Fix segfault with last DBD::Oracle * Break: [pdu/apc] modes refactoring + * Break: [pdu/eaton] modes refactoring 2019-04-12 Quentin Garnier * Plugin added: Google Cloud Platform Compute Engine API diff --git a/hardware/pdu/eaton/snmp/mode/group.pm b/hardware/pdu/eaton/snmp/mode/group.pm index b4da1dc97..89e35eefb 100644 --- a/hardware/pdu/eaton/snmp/mode/group.pm +++ b/hardware/pdu/eaton/snmp/mode/group.pm @@ -82,6 +82,7 @@ sub prefix_group_output { } my $mapping = { + groupName => { oid => '.1.3.6.1.4.1.534.6.6.7.5.1.1.3' }, groupVoltage => { oid => '.1.3.6.1.4.1.534.6.6.7.5.3.1.3' }, # in mVolt groupCurrent => { oid => '.1.3.6.1.4.1.534.6.6.7.5.4.1.3' }, # in mA groupWatts => { oid => '.1.3.6.1.4.1.534.6.6.7.5.5.1.3' }, # in Watt @@ -93,6 +94,7 @@ sub manage_selection { $self->{group} = {}; my $snmp_result = $options{snmp}->get_multiple_table( oids => [ + { oid => $mapping->{groupName}->{oid} }, { oid => $mapping->{groupVoltage}->{oid} }, { oid => $mapping->{groupCurrent}->{oid} }, { oid => $mapping->{groupWatts}->{oid} }, @@ -108,7 +110,9 @@ sub manage_selection { my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance); $result->{groupVoltage} *= 0.001 if (defined($result->{groupVoltage})); $result->{groupCurrent} *= 0.001 if (defined($result->{groupCurrent})); - $self->{group}->{$instance} = { display => $instance, %$result }; + my $display = $instance; + $display = $result->{groupName} if (defined($result->{groupName}) && $result->{groupName} ne ''); + $self->{group}->{$display} = { display => $display, %$result }; } if (scalar(keys %{$self->{group}}) <= 0) { diff --git a/hardware/pdu/eaton/snmp/mode/outlet.pm b/hardware/pdu/eaton/snmp/mode/outlet.pm index 97147d672..cdfce890a 100644 --- a/hardware/pdu/eaton/snmp/mode/outlet.pm +++ b/hardware/pdu/eaton/snmp/mode/outlet.pm @@ -82,6 +82,7 @@ sub prefix_outlet_output { } my $mapping = { + outletName => { oid => '.1.3.6.1.4.1.534.6.6.7.6.1.1.3' }, outletVoltage => { oid => '.1.3.6.1.4.1.534.6.6.7.6.3.1.2' }, # in mVolt outletCurrent => { oid => '.1.3.6.1.4.1.534.6.6.7.6.4.1.3' }, # in mA outletWatts => { oid => '.1.3.6.1.4.1.534.6.6.7.6.5.1.3' }, # in Watt @@ -93,6 +94,7 @@ sub manage_selection { $self->{outlet} = {}; my $snmp_result = $options{snmp}->get_multiple_table( oids => [ + { oid => $mapping->{outletName}->{oid} }, { oid => $mapping->{outletVoltage}->{oid} }, { oid => $mapping->{outletCurrent}->{oid} }, { oid => $mapping->{outletWatts}->{oid} }, @@ -108,7 +110,9 @@ sub manage_selection { my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance); $result->{outletVoltage} *= 0.001 if (defined($result->{outletVoltage})); $result->{outletCurrent} *= 0.001 if (defined($result->{outletCurrent})); - $self->{outlet}->{$instance} = { display => $instance, %$result }; + my $display = $instance; + $display = $result->{outletName} if (defined($result->{outletName}) && $result->{outletName} ne ''); + $self->{outlet}->{$display} = { display => $display, %$result }; } if (scalar(keys %{$self->{outlet}}) <= 0) {