Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Here are the status code of gauge
2 - Dead (Other)
```

Here are the status code of server power
```
0 - Off
1 - On
2 - Other
```

### Output example

Expand Down Expand Up @@ -43,7 +49,8 @@ hpilo_network{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"}
hpilo_temperature{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_vrm{product_name="ProLiant DL380 Gen6",server_name="name.fqdn.domain"} 0.0
hpilo_drive{product_name="ProLiant DL380 Gen6",server_name="name.fqdn.domain"} 0.0
hpilo_firmware_version{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 2.5
hpilo_firmware_version{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 2.78
hpilo_power_status{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 1.0
```

### Installing
Expand Down
11 changes: 11 additions & 0 deletions src/hpilo_exporter/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,18 @@ def do_GET(self):
# prometheus_metrics.hpilo_firmware_version.set(fw_version)
prometheus_metrics.hpilo_firmware_version.labels(product_name=product_name,
server_name=server_name).set(fw_version)
# get power status
power_status = ilo.get_host_power_status()
# prometheus_metrics.hpilo_power_status.set(power_id)
if power_status.upper() == "ON" :
power_id = 1
elif power_status.upper() == "OFF" :
power_id = 0
else :
power_id = 2
prometheus_metrics.hpilo_power_status_gauge.labels(product_name=product_name,server_name=server_name).set(power_id)


# get the amount of time the request took
REQUEST_TIME.observe(time.time() - start_time)

Expand Down
4 changes: 4 additions & 0 deletions src/hpilo_exporter/prometheus_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
hpilo_network_gauge = Gauge('hpilo_network', 'HP iLO network status', ["product_name", "server_name"])
hpilo_temperature_gauge = Gauge('hpilo_temperature', 'HP iLO temperature status', ["product_name", "server_name"])
hpilo_firmware_version = Gauge('hpilo_firmware_version', 'HP iLO firmware version', ["product_name", "server_name"])
hpilo_nic_status_gauge = Gauge('hpilo_nic_status', 'HP iLO individual NIC statuses', ["product_name", "server_name", "nic_name", "ip_address"])
hpilo_power_status_gauge = Gauge('hpilo_power_status', 'HP iLO Server Power Status', ["product_name", "server_name"])

gauges = {
'hpilo_vrm_gauge': hpilo_vrm_gauge,
Expand All @@ -30,4 +32,6 @@
'hpilo_network_gauge': hpilo_network_gauge,
'hpilo_temperature_gauge': hpilo_temperature_gauge,
'hpilo_firmware_version': hpilo_firmware_version,
'hpilo_power_status_gauge': hpilo_power_status_gauge,
'hpilo_nic_status_gauge': hpilo_nic_status_gauge,
}