@@ -656,8 +656,6 @@ def test_collect_hosts():
656656 },
657657 'triggeredAlarmState' : '' ,
658658 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo' : '' ,
659- 'runtime.healthSystemRuntime.hardwareStatusInfo.memoryStatusInfo' : '' ,
660- 'runtime.healthSystemRuntime.hardwareStatusInfo.cpuStatusInfo' : '' ,
661659 },
662660 'host:2' : {
663661 'id' : 'host:2' ,
@@ -667,8 +665,6 @@ def test_collect_hosts():
667665 'summary.customValue' : {},
668666 'triggeredAlarmState' : '' ,
669667 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo' : '' ,
670- 'runtime.healthSystemRuntime.hardwareStatusInfo.memoryStatusInfo' : '' ,
671- 'runtime.healthSystemRuntime.hardwareStatusInfo.cpuStatusInfo' : '' ,
672668 },
673669 'host:3' : {
674670 'id' : 'host:3' ,
@@ -690,8 +686,6 @@ def test_collect_hosts():
690686 'summary.customValue' : {},
691687 'triggeredAlarmState' : '' ,
692688 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo' : '' ,
693- 'runtime.healthSystemRuntime.hardwareStatusInfo.memoryStatusInfo' : '' ,
694- 'runtime.healthSystemRuntime.hardwareStatusInfo.cpuStatusInfo' : '' ,
695689 },
696690 'host:4' : {
697691 'id' : 'host:4' ,
@@ -713,8 +707,6 @@ def test_collect_hosts():
713707 'summary.customValue' : {},
714708 'triggeredAlarmState' : '' ,
715709 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo' : '' ,
716- 'runtime.healthSystemRuntime.hardwareStatusInfo.memoryStatusInfo' : '' ,
717- 'runtime.healthSystemRuntime.hardwareStatusInfo.cpuStatusInfo' : '' ,
718710 },
719711 'host:5' : {
720712 'id' : 'host:5' ,
@@ -740,9 +732,27 @@ def test_collect_hosts():
740732 'triggeredAlarm:HostCPUUsageAlarm:yellow'
741733 )
742734 ),
743- 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo' : 'sensorInfo:OtherAlarm:red' ,
744- 'runtime.healthSystemRuntime.hardwareStatusInfo.memoryStatusInfo' : 'memoryStatusInfo:OtherAlarm:yellow' ,
745- 'runtime.healthSystemRuntime.hardwareStatusInfo.cpuStatusInfo' : 'cpuStatusInfo:OtherAlarm:yellow'
735+ 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo' : ',' .join (
736+ (
737+ 'numericSensorInfo:name=Fan Device 12 System Fan '
738+ '6B:type=fan:sensorStatus=yellow:value=821700:unitModifier=-2:unit=rpm' ,
739+ 'numericSensorInfo:name=Power Supply 2 PS2 '
740+ 'Temperature:type=temperature:sensorStatus=green:value=2900:unitModifier=-2:unit=degrees c' ,
741+ 'numericSensorInfo:name=System Board 1 VR Watchdog '
742+ '0:type=voltage:sensorStatus=red:value=2000:unitModifier=0:unit=volts' ,
743+ 'numericSensorInfo:name=Power Supply 2 Current '
744+ '2:type=power:sensorStatus=green:value=20:unitModifier=-2:unit=amps' ,
745+ 'numericSensorInfo:name=System Board 1 Pwr '
746+ 'Consumption:type=power:sensorStatus=green:value=7000:unitModifier=-2:unit=watts' ,
747+ 'numericSensorInfo:name=Cooling Unit 1 Fan Redundancy '
748+ '0:type=power:sensorStatus=green:value=1:unitModifier=0:unit=redundancy-discrete' ,
749+ 'numericSensorInfo:name=Management Controller Firmware 2 NM '
750+ 'Capabilities:type=other:sensorStatus=unknown:value=5:unitModifier=0:unit=unspecified' ,
751+ 'cpuStatusInfo:name=CPU 1:type=n/a:sensorStatus=green:value=n/a:unitModifier=n/a:unit=n/a' ,
752+ 'memoryStatusInfo:name=Memory 12:type=n/a:sensorStatus=yellow:value=n/a:unitModifier=n/a'
753+ ':unit=n/a' ,
754+ )
755+ ),
746756 },
747757 })
748758 yield collector ._vmware_get_hosts (metrics )
@@ -845,16 +855,108 @@ def test_collect_hosts():
845855 }
846856
847857 # Host:5 testing alarms
848- assert metrics ['vmware_host_yellow_alarms' ].samples [4 ][2 ] == 3
849- assert metrics ['vmware_host_red_alarms' ].samples [4 ][2 ] == 2
858+ assert metrics ['vmware_host_yellow_alarms' ].samples [4 ][2 ] == 1
859+ assert metrics ['vmware_host_red_alarms' ].samples [4 ][2 ] == 1
850860
851861 assert metrics ['vmware_host_yellow_alarms' ].samples [4 ][1 ] == {
852862 'cluster_name' : 'cluster' ,
853863 'customValue1' : 'n/a' ,
854864 'customValue2' : 'n/a' ,
855865 'dc_name' : 'dc' ,
856866 'host_name' : 'host-5' ,
857- 'alarms' : 'triggeredAlarm:HostCPUUsageAlarm,cpuStatusInfo:OtherAlarm,memoryStatusInfo:OtherAlarm'
867+ 'alarms' : 'triggeredAlarm:HostCPUUsageAlarm'
868+ }
869+
870+ # Host:5 testing sensors
871+ assert len (metrics ['vmware_host_sensor_state' ].samples ) == 9
872+ assert metrics ['vmware_host_sensor_state' ].samples [3 ][1 ] == {
873+ 'cluster_name' : 'cluster' ,
874+ 'customValue1' : 'n/a' ,
875+ 'customValue2' : 'n/a' ,
876+ 'dc_name' : 'dc' ,
877+ 'host_name' : 'host-5' ,
878+ 'name' : 'Power Supply 2 Current 2' ,
879+ 'type' : 'power'
880+ }
881+
882+ assert metrics ['vmware_host_sensor_fan' ].samples [0 ][2 ] == 8217
883+ assert metrics ['vmware_host_sensor_fan' ].samples [0 ][1 ] == {
884+ 'cluster_name' : 'cluster' ,
885+ 'customValue1' : 'n/a' ,
886+ 'customValue2' : 'n/a' ,
887+ 'dc_name' : 'dc' ,
888+ 'host_name' : 'host-5' ,
889+ 'name' : 'Fan Device 12 System Fan 6B' ,
890+ }
891+
892+ assert metrics ['vmware_host_sensor_temperature' ].samples [0 ][2 ] == 29
893+ assert metrics ['vmware_host_sensor_temperature' ].samples [0 ][1 ] == {
894+ 'cluster_name' : 'cluster' ,
895+ 'customValue1' : 'n/a' ,
896+ 'customValue2' : 'n/a' ,
897+ 'dc_name' : 'dc' ,
898+ 'host_name' : 'host-5' ,
899+ 'name' : 'Power Supply 2 PS2 Temperature' ,
900+ }
901+
902+ assert metrics ['vmware_host_sensor_power_voltage' ].samples [0 ][2 ] == 2000
903+ assert metrics ['vmware_host_sensor_power_voltage' ].samples [0 ][1 ] == {
904+ 'cluster_name' : 'cluster' ,
905+ 'customValue1' : 'n/a' ,
906+ 'customValue2' : 'n/a' ,
907+ 'dc_name' : 'dc' ,
908+ 'host_name' : 'host-5' ,
909+ 'name' : 'System Board 1 VR Watchdog 0' ,
910+ }
911+
912+ assert metrics ['vmware_host_sensor_power_current' ].samples [0 ][2 ] == 0.2
913+ assert metrics ['vmware_host_sensor_power_current' ].samples [0 ][1 ] == {
914+ 'cluster_name' : 'cluster' ,
915+ 'customValue1' : 'n/a' ,
916+ 'customValue2' : 'n/a' ,
917+ 'dc_name' : 'dc' ,
918+ 'host_name' : 'host-5' ,
919+ 'name' : 'Power Supply 2 Current 2' ,
920+ }
921+
922+ assert metrics ['vmware_host_sensor_power_watt' ].samples [0 ][2 ] == 70
923+ assert metrics ['vmware_host_sensor_power_watt' ].samples [0 ][1 ] == {
924+ 'cluster_name' : 'cluster' ,
925+ 'customValue1' : 'n/a' ,
926+ 'customValue2' : 'n/a' ,
927+ 'dc_name' : 'dc' ,
928+ 'host_name' : 'host-5' ,
929+ 'name' : 'System Board 1 Pwr Consumption' ,
930+ }
931+
932+ assert metrics ['vmware_host_sensor_redundancy' ].samples [0 ][2 ] == 1
933+ assert metrics ['vmware_host_sensor_redundancy' ].samples [0 ][1 ] == {
934+ 'cluster_name' : 'cluster' ,
935+ 'customValue1' : 'n/a' ,
936+ 'customValue2' : 'n/a' ,
937+ 'dc_name' : 'dc' ,
938+ 'host_name' : 'host-5' ,
939+ 'name' : 'Cooling Unit 1 Fan Redundancy 0' ,
940+ }
941+
942+ assert metrics ['vmware_host_sensor_state' ].samples [7 ][1 ] == {
943+ 'cluster_name' : 'cluster' ,
944+ 'customValue1' : 'n/a' ,
945+ 'customValue2' : 'n/a' ,
946+ 'dc_name' : 'dc' ,
947+ 'host_name' : 'host-5' ,
948+ 'name' : 'CPU 1' ,
949+ 'type' : 'n/a'
950+ }
951+
952+ assert metrics ['vmware_host_sensor_state' ].samples [8 ][1 ] == {
953+ 'cluster_name' : 'cluster' ,
954+ 'customValue1' : 'n/a' ,
955+ 'customValue2' : 'n/a' ,
956+ 'dc_name' : 'dc' ,
957+ 'host_name' : 'host-5' ,
958+ 'name' : 'Memory 12' ,
959+ 'type' : 'n/a'
858960 }
859961
860962
0 commit comments