fix eaton pdu snmp
This commit is contained in:
parent
7472d174df
commit
7f86397bed
|
@ -34,29 +34,29 @@ sub set_counters {
|
||||||
|
|
||||||
$self->{maps_counters}->{group} = [
|
$self->{maps_counters}->{group} = [
|
||||||
{ label => 'current', nlabel => 'group.current.ampere', set => {
|
{ label => 'current', nlabel => 'group.current.ampere', set => {
|
||||||
key_values => [ { name => 'groupCurrent', no_value => 0 } ],
|
key_values => [ { name => 'groupCurrent', no_value => 0 }, { name => 'display' } ],
|
||||||
output_template => 'Current : %.2f A',
|
output_template => 'Current : %.2f A',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ value => 'groupCurrent_absolute', template => '%.2f',
|
{ value => 'groupCurrent_absolute', template => '%.2f',
|
||||||
min => 0, unit => 'A', label_extra_instance => 1 },
|
min => 0, unit => 'A', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'voltage', nlabel => 'group.voltage.volt', set => {
|
{ label => 'voltage', nlabel => 'group.voltage.volt', set => {
|
||||||
key_values => [ { name => 'groupVoltage', no_value => 0 } ],
|
key_values => [ { name => 'groupVoltage', no_value => 0 }, { name => 'display' } ],
|
||||||
output_template => 'Voltage : %.2f V',
|
output_template => 'Voltage : %.2f V',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ value => 'groupVoltage_absolute', template => '%.2f',
|
{ value => 'groupVoltage_absolute', template => '%.2f',
|
||||||
unit => 'V', label_extra_instance => 1 },
|
unit => 'V', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'power', nlabel => 'group.power.watt', set => {
|
{ label => 'power', nlabel => 'group.power.watt', set => {
|
||||||
key_values => [ { name => 'groupWatts', no_value => 0 } ],
|
key_values => [ { name => 'groupWatts', no_value => 0 }, { name => 'display' } ],
|
||||||
output_template => 'Power : %.2f W',
|
output_template => 'Power : %.2f W',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ value => 'groupWatts_absolute', template => '%.2f',
|
{ value => 'groupWatts_absolute', template => '%.2f',
|
||||||
unit => 'W', label_extra_instance => 1 },
|
unit => 'W', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -102,16 +102,18 @@ sub manage_selection {
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach my $oid (keys %{$snmp_result}) {
|
foreach my $oid (keys %{$snmp_result}) {
|
||||||
$oid =~ /\.(\d+\.\d+)$/;
|
$oid =~ /\.(\d+)\.(\d+)$/;
|
||||||
my $instance = $1;
|
my ($strapping_index, $group_index) = ($1, $2);
|
||||||
next if (defined($self->{group}->{$instance}));
|
next if (defined($self->{group}->{$strapping_index . '.' . $group_index}));
|
||||||
|
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $strapping_index . '.' . $group_index);
|
||||||
$result->{groupVoltage} *= 0.001 if (defined($result->{groupVoltage}));
|
$result->{groupVoltage} *= 0.001 if (defined($result->{groupVoltage}));
|
||||||
$result->{groupCurrent} *= 0.001 if (defined($result->{groupCurrent}));
|
$result->{groupCurrent} *= 0.001 if (defined($result->{groupCurrent}));
|
||||||
my $display = $instance;
|
my $display = $strapping_index . '.' . $group_index;
|
||||||
$display = $result->{groupName} if (defined($result->{groupName}) && $result->{groupName} ne '');
|
if (defined($result->{groupName}) && $result->{groupName} ne '') {
|
||||||
$self->{group}->{$display} = { display => $display, %$result };
|
$display = $result->{groupName} . ' strapping ' . $strapping_index;
|
||||||
|
}
|
||||||
|
$self->{group}->{$strapping_index . '.' . $group_index} = { display => $display, %$result };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(keys %{$self->{group}}) <= 0) {
|
if (scalar(keys %{$self->{group}}) <= 0) {
|
||||||
|
|
|
@ -34,29 +34,29 @@ sub set_counters {
|
||||||
|
|
||||||
$self->{maps_counters}->{outlet} = [
|
$self->{maps_counters}->{outlet} = [
|
||||||
{ label => 'current', nlabel => 'outlet.current.ampere', set => {
|
{ label => 'current', nlabel => 'outlet.current.ampere', set => {
|
||||||
key_values => [ { name => 'outletCurrent', no_value => 0 } ],
|
key_values => [ { name => 'outletCurrent', no_value => 0 }, { name => 'display' } ],
|
||||||
output_template => 'Current : %.2f A',
|
output_template => 'Current : %.2f A',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ value => 'outletCurrent_absolute', template => '%.2f',
|
{ value => 'outletCurrent_absolute', template => '%.2f',
|
||||||
min => 0, unit => 'A', label_extra_instance => 1 },
|
min => 0, unit => 'A', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'voltage', nlabel => 'outlet.voltage.volt', set => {
|
{ label => 'voltage', nlabel => 'outlet.voltage.volt', set => {
|
||||||
key_values => [ { name => 'outletVoltage', no_value => 0 } ],
|
key_values => [ { name => 'outletVoltage', no_value => 0 }, { name => 'display' } ],
|
||||||
output_template => 'Voltage : %.2f V',
|
output_template => 'Voltage : %.2f V',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ value => 'outletVoltage_absolute', template => '%.2f',
|
{ value => 'outletVoltage_absolute', template => '%.2f',
|
||||||
unit => 'V', label_extra_instance => 1 },
|
unit => 'V', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'power', nlabel => 'outlet.power.watt', set => {
|
{ label => 'power', nlabel => 'outlet.power.watt', set => {
|
||||||
key_values => [ { name => 'outletWatts', no_value => 0 } ],
|
key_values => [ { name => 'outletWatts', no_value => 0 }, { name => 'display' } ],
|
||||||
output_template => 'Power : %.2f W',
|
output_template => 'Power : %.2f W',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ value => 'outletWatts_absolute', template => '%.2f',
|
{ value => 'outletWatts_absolute', template => '%.2f',
|
||||||
unit => 'W', label_extra_instance => 1 },
|
unit => 'W', label_extra_instance => 1, instance_use => 'display_absolute' },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -102,16 +102,19 @@ sub manage_selection {
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach my $oid (keys %{$snmp_result}) {
|
foreach my $oid (keys %{$snmp_result}) {
|
||||||
$oid =~ /\.(\d+\.\d+)$/;
|
$oid =~ /\.(\d+)\.(\d+)$/;
|
||||||
my $instance = $1;
|
my ($strapping_index, $outlet_index) = ($1, $2);
|
||||||
next if (defined($self->{outlet}->{$instance}));
|
|
||||||
|
|
||||||
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance);
|
next if (defined($self->{outlet}->{$strapping_index . '.' . $outlet_index}));
|
||||||
|
|
||||||
|
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $strapping_index . '.' . $outlet_index);
|
||||||
$result->{outletVoltage} *= 0.001 if (defined($result->{outletVoltage}));
|
$result->{outletVoltage} *= 0.001 if (defined($result->{outletVoltage}));
|
||||||
$result->{outletCurrent} *= 0.001 if (defined($result->{outletCurrent}));
|
$result->{outletCurrent} *= 0.001 if (defined($result->{outletCurrent}));
|
||||||
my $display = $instance;
|
my $display = $strapping_index . '.' . $outlet_index;
|
||||||
$display = $result->{outletName} if (defined($result->{outletName}) && $result->{outletName} ne '');
|
if (defined($result->{outletName}) && $result->{outletName} ne '') {
|
||||||
$self->{outlet}->{$display} = { display => $display, %$result };
|
$display = $result->{outletName} . ' strapping ' . $strapping_index;
|
||||||
|
}
|
||||||
|
$self->{outlet}->{$strapping_index . '.' . $outlet_index} = { display => $display, %$result };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(keys %{$self->{outlet}}) <= 0) {
|
if (scalar(keys %{$self->{outlet}}) <= 0) {
|
||||||
|
|
Loading…
Reference in New Issue