Skip to content

Commit da50e10

Browse files
Danny Kulchinskypryorda
authored andcommitted
fix(#120): fix unknown power states
1 parent e2db0b9 commit da50e10

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

vmware_exporter/vmware_exporter.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,13 @@ def _vmware_get_hosts(self, host_metrics):
717717
power_state = 1 if host['runtime.powerState'] == 'poweredOn' else 0
718718
host_metrics['vmware_host_power_state'].add_metric(labels, power_state)
719719

720+
# Host connection state (connected, disconnected, notResponding)
721+
connection_state = host.get('runtime.connectionState', 'unknown')
722+
host_metrics['vmware_host_connection_state'].add_metric(
723+
labels + [connection_state],
724+
1
725+
)
726+
720727
if not power_state:
721728
continue
722729

@@ -728,13 +735,6 @@ def _vmware_get_hosts(self, host_metrics):
728735
self._to_epoch(host['runtime.bootTime'])
729736
)
730737

731-
# Host connection state (connected, disconnected, notResponding)
732-
connection_state = host.get('runtime.connectionState', 'unknown')
733-
host_metrics['vmware_host_connection_state'].add_metric(
734-
labels + [connection_state],
735-
1
736-
)
737-
738738
# Host in maintenance mode?
739739
if 'runtime.inMaintenanceMode' in host:
740740
host_metrics['vmware_host_maintenance_mode'].add_metric(

0 commit comments

Comments
 (0)