mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-30 17:15:11 +02:00
Fix power unit and add Voltage metric (#5187)
Co-authored-by: Lucie Dubrunfaut <ldubrunfaut@CNTR-PORT-A198> Co-authored-by: sfarouq-ext <116093375+sfarouq-ext@users.noreply.github.com> Refs : CTOR-887
This commit is contained in:
parent
11482e4d40
commit
bc6c0ae9b1
@ -120,6 +120,14 @@ sub set_counters {
|
|||||||
{ template => '%s', unit => 'W', min => 0, label_extra_instance => 1 }
|
{ template => '%s', unit => 'W', min => 0, label_extra_instance => 1 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{ label => 'phase-voltage', nlabel => 'phase.voltage.volt', set => {
|
||||||
|
key_values => [ { name => 'voltage' } ],
|
||||||
|
output_template => 'voltage : %s V',
|
||||||
|
perfdatas => [
|
||||||
|
{ template => '%s', unit => 'V', min => 0, label_extra_instance => 1 }
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -197,6 +205,7 @@ sub check_pdu2 {
|
|||||||
number => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.3' }, # ePDU2PhaseStatusNumber
|
number => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.3' }, # ePDU2PhaseStatusNumber
|
||||||
state => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.4', map => $map_pdu_status }, # ePDU2PhaseStatusLoadState
|
state => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.4', map => $map_pdu_status }, # ePDU2PhaseStatusLoadState
|
||||||
current => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.5' }, # ePDU2PhaseStatusLoad
|
current => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.5' }, # ePDU2PhaseStatusLoad
|
||||||
|
voltage => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.6' }, # ePDU2PhaseStatusVoltage
|
||||||
power => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.7' } # ePDU2PhaseStatusPower
|
power => { oid => '.1.3.6.1.4.1.3808.1.1.6.4.4.1.7' } # ePDU2PhaseStatusPower
|
||||||
};
|
};
|
||||||
my $mapping_bank = {
|
my $mapping_bank = {
|
||||||
@ -230,7 +239,8 @@ sub check_pdu2 {
|
|||||||
display => $result->{number},
|
display => $result->{number},
|
||||||
state => $result->{state},
|
state => $result->{state},
|
||||||
current => $result->{current} / 10,
|
current => $result->{current} / 10,
|
||||||
power => $result->{power} * 10 # hundreth of kW. So * 10 for watt
|
voltage => $result->{voltage}/10,
|
||||||
|
power => $result->{power}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +327,7 @@ You can use the following variables: %{state}, %{display}
|
|||||||
=item B<--warning-*> B<--critical-*>
|
=item B<--warning-*> B<--critical-*>
|
||||||
|
|
||||||
Thresholds.
|
Thresholds.
|
||||||
Can be: 'phase-current', 'phase-power', 'bank-current'.
|
Can be: 'phase-current', 'phase-power', 'phase-voltage', 'bank-current'.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
1148
tests/hardware/pdu/cyberpower/snmp/CyberPower.snmpwalk
Normal file
1148
tests/hardware/pdu/cyberpower/snmp/CyberPower.snmpwalk
Normal file
File diff suppressed because it is too large
Load Diff
38
tests/hardware/pdu/cyberpower/snmp/load.robot
Normal file
38
tests/hardware/pdu/cyberpower/snmp/load.robot
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
***Settings***
|
||||||
|
Documentation Hardware Camera Avigilon memory
|
||||||
|
|
||||||
|
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||||
|
|
||||||
|
Test Timeout 120s
|
||||||
|
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${CMD} ${CENTREON_PLUGINS}
|
||||||
|
... --plugin=hardware::pdu::cyberpower::snmp::plugin
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
load ${tc}
|
||||||
|
[Documentation] Hardware Camera Avigilon Memory
|
||||||
|
[Tags] hardware cyberpower load
|
||||||
|
${command} Catenate
|
||||||
|
... ${CMD}
|
||||||
|
... --mode=load
|
||||||
|
... --hostname=${HOSTNAME}
|
||||||
|
... --snmp-port=${SNMPPORT}
|
||||||
|
... --snmp-community=hardware/pdu/cyberpower/snmp/CyberPower
|
||||||
|
... ${extraoptions}
|
||||||
|
|
||||||
|
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||||
|
|
||||||
|
Examples: tc extraoptions expected_result --
|
||||||
|
... 1 --warning-phase-status='\\\%{state} =~ /low|nearOverload/i' OK: Device 'ATS011' bank '1' current : 1 A - phase '1' state: normal, current : 1 A, power : 219 W, voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 2 --critical-phase-status='\\\%{state} =~ /^overload/i' OK: Device 'ATS011' bank '1' current : 1 A - phase '1' state: normal, current : 1 A, power : 219 W, voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 4 --warning-phase-power='0' WARNING: Device 'ATS011' phase '1' power : 219 W | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;0:0;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 5 --warning-phase-voltage='0' WARNING: Device 'ATS011' phase '1' voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;0:0;;0;
|
||||||
|
... 6 --warning-bank-current='' OK: Device 'ATS011' bank '1' current : 1 A - phase '1' state: normal, current : 1 A, power : 219 W, voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 7 --critical-phase-current='0' CRITICAL: Device 'ATS011' phase '1' current : 1 A | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;0:0;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 8 --critical-phase-power='0' CRITICAL: Device 'ATS011' phase '1' power : 219 W | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;0:0;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 9 --critical-phase-voltage='300' OK: Device 'ATS011' bank '1' current : 1 A - phase '1' state: normal, current : 1 A, power : 219 W, voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;0:300;0;
|
||||||
|
... 10 --critical-bank-current='' OK: Device 'ATS011' bank '1' current : 1 A - phase '1' state: normal, current : 1 A, power : 219 W, voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 11 --warning-phase-status='\\\%{display} =~ /low|nearOverload/i' OK: Device 'ATS011' bank '1' current : 1 A - phase '1' state: normal, current : 1 A, power : 219 W, voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
||||||
|
... 12 --critical-phase-status='\\\%{display} =~ /^overload/i' OK: Device 'ATS011' bank '1' current : 1 A - phase '1' state: normal, current : 1 A, power : 219 W, voltage : 217.8 V | 'ATS011~1#bank.current.ampere'=1A;;;0; 'ATS011~1#phase.current.ampere'=1A;;;0; 'ATS011~1#phase.power.watt'=219W;;;0; 'ATS011~1#phase.voltage.volt'=217.8V;;;0;
|
42
tests/hardware/pdu/cyberpower/snmp/outlets.robot
Normal file
42
tests/hardware/pdu/cyberpower/snmp/outlets.robot
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
***Settings***
|
||||||
|
Documentation Hardware Camera Avigilon memory
|
||||||
|
|
||||||
|
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
|
||||||
|
|
||||||
|
Test Timeout 120s
|
||||||
|
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${CMD} ${CENTREON_PLUGINS}
|
||||||
|
... --plugin=hardware::pdu::cyberpower::snmp::plugin
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
outlets ${tc}
|
||||||
|
[Documentation] Hardware Camera Avigilon Memory
|
||||||
|
[Tags] hardware cyberpower outlets
|
||||||
|
${command} Catenate
|
||||||
|
... ${CMD}
|
||||||
|
... --mode=outlets
|
||||||
|
... --hostname=${HOSTNAME}
|
||||||
|
... --snmp-port=${SNMPPORT}
|
||||||
|
... --snmp-community=hardware/pdu/cyberpower/snmp/CyberPower
|
||||||
|
... ${extraoptions}
|
||||||
|
|
||||||
|
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
|
||||||
|
|
||||||
|
Examples: tc extraoptions expected_result --
|
||||||
|
... 1 --unknown-status='\\\%{state} =~ /on/' UNKNOWN: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 2 --unknown-status OK: Device 'ATS011' outlets are ok
|
||||||
|
... 3 --warning-status='\\\%{state} =~ /on/' WARNING: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 4 --critical-status='\\\%{state} =~ /on/' CRITICAL: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 5 --warning-current='' OK: Device 'ATS011' outlets are ok
|
||||||
|
... 6 --critical-current='' OK: Device 'ATS011' outlets are ok
|
||||||
|
... 7 --unknown-status='\\\%{phase} =~ /-/' UNKNOWN: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 8 --unknown-status='\\\%{bank} =~ /1/' UNKNOWN: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 9 --critical-status='\\\%{phase} =~ /-/' CRITICAL: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 10 --critical-status='\\\%{bank} =~ /1/' CRITICAL: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 11 --critical-status='\\\%{display} =~ /off/' OK: Device 'ATS011' outlets are ok
|
||||||
|
... 12 --warning-status='\\\%{bank} =~ /1/' WARNING: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
... 13 --warning-status='\\\%{display} =~ /off/' OK: Device 'ATS011' outlets are ok
|
||||||
|
... 14 --warning-status='\\\%{phase} =~ /-/' WARNING: Device 'ATS011' outlet 'Outlet1 bank 1' state: 'on' [phase: -] - outlet 'Outlet10 bank 1' state: 'on' [phase: -] - outlet 'Outlet2 bank 1' state: 'on' [phase: -] - outlet 'Outlet3 bank 1' state: 'on' [phase: -] - outlet 'Outlet4 bank 1' state: 'on' [phase: -] - outlet 'Outlet5 bank 1' state: 'on' [phase: -] - outlet 'Outlet6 bank 1' state: 'on' [phase: -] - outlet 'Outlet7 bank 1' state: 'on' [phase: -] - outlet 'Outlet8 bank 1' state: 'on' [phase: -] - outlet 'Outlet9 bank 1' state: 'on' [phase: -]
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user