diff --git a/README.md b/README.md index 0b8a6c7..3b735db 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Blackbox likes exporter used to exports HP Server Integrated Lights Out (iLO) states to Prometheus. +Sample data: https://jsoneditoronline.org/#left=cloud.ed5e0fe56d8d4e0f94a53576c879f404&right=local.nalera + ### Gauges Here are the status code of gauge diff --git a/grafana_dashboard.json b/grafana_dashboard.json new file mode 100644 index 0000000..31edc07 --- /dev/null +++ b/grafana_dashboard.json @@ -0,0 +1,1411 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 6, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 0, + "y": 0 + }, + "id": 13, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "name" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "exemplar": false, + "expr": "hpilo_firmware_version{server_name=\"$server_name\"}", + "instant": true, + "legendFormat": "{{server_name}}", + "range": false, + "refId": "A" + } + ], + "title": "Server name", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Power" + }, + "properties": [ + { + "id": "unit", + "value": "kwatth" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Estimated money" + }, + "properties": [ + { + "id": "unit", + "value": "currencyVND" + } + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 5, + "x": 3, + "y": 0 + }, + "id": 19, + "interval": "5m", + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum_over_time(hpilo_power_supplies_reading{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}[$__range]) / (count_over_time(hpilo_power_supplies_reading{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}[1m]) * 60) / 1000", + "legendFormat": "Power", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum_over_time(hpilo_power_supplies_reading{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}[$__range]) / (count_over_time(hpilo_power_supplies_reading{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}[1m]) * 60) / 1000 * 2000", + "hide": false, + "legendFormat": "Estimated money", + "range": true, + "refId": "B" + } + ], + "title": "Power consumtion", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 40 + }, + { + "color": "dark-orange", + "value": 60 + }, + { + "color": "dark-red", + "value": 85 + } + ] + }, + "unit": "watt" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "dedi3" + }, + "properties": [ + { + "id": "min", + "value": 0 + }, + { + "id": "max", + "value": 250 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "dedi2" + }, + "properties": [ + { + "id": "max", + "value": 500 + }, + { + "id": "min", + "value": 0 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "dedi5" + }, + "properties": [ + { + "id": "max", + "value": 300 + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 8, + "y": 0 + }, + "id": 15, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum(hpilo_power_supplies_reading{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}) by (server_name)", + "legendFormat": "{{server_name}}", + "range": true, + "refId": "A" + } + ], + "title": "Power reading", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 40 + }, + { + "color": "dark-orange", + "value": 60 + }, + { + "color": "dark-red", + "value": 85 + } + ] + }, + "unit": "watt" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "dedi3" + }, + "properties": [ + { + "id": "min", + "value": 0 + }, + { + "id": "max", + "value": 250 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "dedi2" + }, + "properties": [ + { + "id": "max", + "value": 500 + }, + { + "id": "min", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 20, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum(hpilo_power_supplies_reading{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}) by (server_name)", + "legendFormat": "{{server_name}}", + "range": true, + "refId": "A" + } + ], + "title": "Power reading", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 5, + "x": 0, + "y": 4 + }, + "id": 4, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "firstNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "name" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "exemplar": false, + "expr": "hpilo_firmware_version{server_name=\"$server_name\"}", + "instant": true, + "legendFormat": "{{product_name}}", + "range": false, + "refId": "A" + } + ], + "title": "Server hardware", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 3, + "x": 5, + "y": 4 + }, + "id": 9, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_firmware_version{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "iLO version", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "celsius" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 6 + }, + "id": 7, + "options": { + "legend": { + "calcs": [ + "max", + "lastNotNull", + "diff" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum(hpilo_temperature_detail{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}) by (server_name, label)", + "legendFormat": "{{server_name}} {{label}}", + "range": true, + "refId": "A" + } + ], + "title": "Components Temperature", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "color": "semi-dark-green", + "index": 0, + "text": "OK" + }, + "1": { + "color": "semi-dark-yellow", + "index": 1, + "text": "Degraded" + }, + "2": { + "color": "dark-red", + "index": 2, + "text": "Dead/Other" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 6 + }, + "id": 12, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "value_and_name" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_battery{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": true, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_storage{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_fans{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_bios_hardware{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_memory{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "E" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_power_supplies{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "F" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_processor{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "G" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_network{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "H" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_temperature{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "I" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_vrm{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": false, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "J" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_drive{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "hide": true, + "legendFormat": "{{__name__}}", + "range": true, + "refId": "K" + } + ], + "title": "Overall health", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decgbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 0, + "y": 15 + }, + "id": 22, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum(hpilo_memory_detail{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"})", + "legendFormat": "Total memory", + "range": true, + "refId": "A" + } + ], + "title": "Total memory", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "decgbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 3, + "y": 15 + }, + "id": 23, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "name" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "exemplar": false, + "expr": "topk(1, hpilo_memory_detail{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"})", + "format": "time_series", + "instant": false, + "legendFormat": "{{operating_frequency}}", + "range": true, + "refId": "A" + } + ], + "title": "Memory speed", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 6, + "y": 15 + }, + "id": 28, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "name" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum(hpilo_power_supplies_detail{capacity_w!=\"0\", server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}) by (psu_id, capacity_w)", + "legendFormat": "PSU {{psu_id}} - {{capacity_w}} W", + "range": true, + "refId": "A" + } + ], + "title": "PSU status", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 12, + "x": 12, + "y": 15 + }, + "id": 17, + "options": { + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "sum(hpilo_fans_speed_percent{server_name=\"$server_name\"}) by (fan_id)", + "legendFormat": "Fan {{fan_id}}", + "range": true, + "refId": "A" + } + ], + "title": "Fan speed", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decgbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 8, + "x": 0, + "y": 18 + }, + "id": 24, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "name" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "exemplar": false, + "expr": "topk(1, hpilo_processor_detail{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"})", + "format": "time_series", + "instant": false, + "legendFormat": "{{name}}", + "range": true, + "refId": "A" + } + ], + "title": "CPU name", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 8, + "y": 18 + }, + "id": 25, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "exemplar": false, + "expr": "count(hpilo_processor_detail{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"})", + "format": "time_series", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "CPU socket", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "color": "dark-red", + "index": 1, + "text": "Failure" + }, + "1": { + "color": "dark-green", + "index": 0, + "text": "Good" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 22 + }, + "id": 27, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "value_and_name" + }, + "pluginVersion": "9.1.6", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "editorMode": "code", + "expr": "hpilo_power_supplies_detail{server_name=\"$server_name\", product_name!=\"Unknown HP Server\"}", + "legendFormat": "{{label}} - {{status}}", + "range": true, + "refId": "A" + } + ], + "title": "PSU status", + "type": "stat" + } + ], + "refresh": false, + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": true, + "text": "dedi3", + "value": "dedi3" + }, + "datasource": { + "type": "prometheus", + "uid": "ME26p0jnz" + }, + "definition": "label_values(hpilo_bios_hardware, server_name)", + "hide": 0, + "includeAll": false, + "label": "Server", + "multi": false, + "name": "server_name", + "options": [], + "query": { + "query": "label_values(hpilo_bios_hardware, server_name)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "dedi.*", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "2023-03-01T12:37:56.028Z", + "to": "2023-03-01T13:49:52.446Z" + }, + "timepicker": {}, + "timezone": "", + "title": "HP iLO", + "uid": "7Kh-LB4Vk", + "version": 38, + "weekStart": "" +} diff --git a/src/hpilo_exporter/exporter.py b/src/hpilo_exporter/exporter.py index 319e89d..4ccf6c2 100644 --- a/src/hpilo_exporter/exporter.py +++ b/src/hpilo_exporter/exporter.py @@ -96,24 +96,59 @@ def do_GET(self): except: server_name = ilo_host + # get health embedded_health = ilo.get_embedded_health() health_at_glance = embedded_health['health_at_a_glance'] - + + for module in embedded_health['temperature'].values(): + if module['status'] != 'Not Installed': + prometheus_metrics.gauges["hpilo_temperature_detail_gauge"].labels(label=module['label'], product_name=product_name, server_name=server_name).set(int(module['currentreading'][0])) + + present_power_reading = int(embedded_health['power_supply_summary']['present_power_reading'].split()[0]) + prometheus_metrics.gauges["hpilo_power_supplies_reading_gauge"].labels(product_name=product_name, server_name=server_name).set(present_power_reading) + + for fan in embedded_health['fans'].values(): + prometheus_metrics.gauges["hpilo_fans_speed_percent_gauge"].labels(fan_status=fan['status'], fan_name=fan['label'], fan_id=fan['label'].split()[-1], product_name=product_name, server_name=server_name).set(0 if present_power_reading == 0 else int(fan['speed'][0])) + + memory_detail = embedded_health['memory']['memory_details_summary'] if 'memory_details_summary' in embedded_health['memory'] else embedded_health['memory']['memory_components'] + + # For HP server Gen 8 or lower + if 'memory_details_summary' in embedded_health['memory']: + for cpu_idx, cpu in memory_detail.items(): + total_memory_size = 0 if (cpu['total_memory_size'] == 'N/A') else int(cpu['total_memory_size'].split()[0]) + prometheus_metrics.gauges["hpilo_memory_detail_gauge"].labels(product_name=product_name, server_name=server_name, cpu_id=cpu_idx.split("_")[1], operating_frequency=cpu['operating_frequency'], operating_voltage=cpu['operating_voltage']).set(total_memory_size) + + # For HP server Gen 9 or higher + if 'memory_components' in embedded_health['memory']: + memory_components = embedded_health['memory']['memory_components'] + for cpu_idx in range(0, len(memory_components)): + cpu = memory_components[cpu_idx] + total_memory_size = 0 if (cpu[1][1]['value'] == 'Not Installed') else int(cpu[1][1]['value'].split(' ')[0]) / 1024 + operating_frequency = cpu[2][1]['value'] + # Not expose operating_voltage + prometheus_metrics.gauges["hpilo_memory_detail_gauge"].labels(product_name=product_name, server_name=server_name, cpu_id=cpu_idx, operating_frequency=operating_frequency, operating_voltage='').set(total_memory_size) + + for psu in embedded_health['power_supplies'].values(): + capacity_w = 0 if psu["capacity"] == "N/A" else int(psu["capacity"].split()[0]) + prometheus_metrics.gauges["hpilo_power_supplies_detail_gauge"].labels(product_name=product_name, server_name=server_name, psu_id=psu['label'].split()[-1], label=psu['label'], status=psu['status'], capacity_w=capacity_w, present=psu["present"]).set(1 if "Good" in psu["status"] else 0) + + for cpu in embedded_health['processors'].values(): + prometheus_metrics.gauges["hpilo_processor_detail_gauge"].labels(product_name=product_name, server_name=server_name, cpu_id=cpu['label'].split()[1], name=cpu['name'].strip(), status=cpu['status'], speed=cpu['speed']).set(1 if "OK" in cpu["status"] else 0) + if health_at_glance is not None: for key, value in health_at_glance.items(): + for status in value.items(): if status[0] == 'status': gauge = 'hpilo_{}_gauge'.format(key) if status[1].upper() == 'OK': - prometheus_metrics.gauges[gauge].labels(product_name=product_name, - server_name=server_name).set(0) + prometheus_metrics.gauges[gauge].labels(product_name=product_name,server_name=server_name).set(0) elif status[1].upper() == 'DEGRADED': - prometheus_metrics.gauges[gauge].labels(product_name=product_name, - server_name=server_name).set(1) + prometheus_metrics.gauges[gauge].labels(product_name=product_name,server_name=server_name).set(1) else: - prometheus_metrics.gauges[gauge].labels(product_name=product_name, - server_name=server_name).set(2) + prometheus_metrics.gauges[gauge].labels(product_name=product_name,server_name=server_name).set(2) + #for iLO3 patch network if ilo.get_fw_version()["management_processor"] == 'iLO3': print_err('Unknown iLO nic status') diff --git a/src/hpilo_exporter/prometheus_metrics.py b/src/hpilo_exporter/prometheus_metrics.py index 16f9f72..0ae1c47 100644 --- a/src/hpilo_exporter/prometheus_metrics.py +++ b/src/hpilo_exporter/prometheus_metrics.py @@ -8,26 +8,40 @@ hpilo_battery_gauge = Gauge('hpilo_battery', 'HP iLO battery status', ["product_name", "server_name"]) hpilo_storage_gauge = Gauge('hpilo_storage', 'HP iLO storage status', ["product_name", "server_name"]) hpilo_fans_gauge = Gauge('hpilo_fans', 'HP iLO fans status', ["product_name", "server_name"]) +hpilo_fans_speed_percent_gauge = Gauge('hpilo_fans_speed_percent', 'HP iLO fans speed percent', ["product_name", "server_name", "fan_name", "fan_id", "fan_status"]) hpilo_bios_hardware_gauge = Gauge('hpilo_bios_hardware', 'HP iLO bios_hardware status', ["product_name", "server_name"]) hpilo_memory_gauge = Gauge('hpilo_memory', 'HP iLO memory status', ["product_name", "server_name"]) -hpilo_power_supplies_gauge = Gauge('hpilo_power_supplies', 'HP iLO power_supplies status', ["product_name", - "server_name"]) +hpilo_memory_detail_gauge = Gauge('hpilo_memory_detail', 'HP iLO memory detail info', ["product_name", "server_name", "cpu_id", "operating_frequency", "operating_voltage"]) +hpilo_power_supplies_gauge = Gauge('hpilo_power_supplies', 'HP iLO power_supplies status', ["product_name","server_name"]) +hpilo_power_supplies_detail_gauge = Gauge('hpilo_power_supplies_detail', 'HP iLO power_supplies detail', ["product_name","server_name", "psu_id", "label", "status", "capacity_w", "present"]) +hpilo_power_supplies_reading_gauge = Gauge('hpilo_power_supplies_reading', 'HP iLO power_supplies reading', ["product_name","server_name"]) hpilo_processor_gauge = Gauge('hpilo_processor', 'HP iLO processor status', ["product_name", "server_name"]) +hpilo_processor_detail_gauge = Gauge('hpilo_processor_detail', 'HP iLO processor detail', ["product_name", "server_name", "name", "status", "cpu_id", "speed"]) 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_temperature_detail_gauge = Gauge('hpilo_temperature_detail', 'HP iLO temperature detail', ["product_name", "server_name", "label"]) hpilo_firmware_version = Gauge('hpilo_firmware_version', 'HP iLO firmware version', ["product_name", "server_name"]) +hpilo_nic_status_gauge = Gauge('hpilo_nic_status_gauge', 'HP iLO NIC status', ["product_name", "server_name", "nic_name", "ip_address"]) + gauges = { 'hpilo_vrm_gauge': hpilo_vrm_gauge, 'hpilo_drive_gauge': hpilo_drive_gauge, 'hpilo_battery_gauge': hpilo_battery_gauge, 'hpilo_storage_gauge': hpilo_storage_gauge, 'hpilo_fans_gauge': hpilo_fans_gauge, + 'hpilo_fans_speed_percent_gauge': hpilo_fans_speed_percent_gauge, 'hpilo_bios_hardware_gauge': hpilo_bios_hardware_gauge, 'hpilo_memory_gauge': hpilo_memory_gauge, + 'hpilo_memory_detail_gauge': hpilo_memory_detail_gauge, 'hpilo_power_supplies_gauge': hpilo_power_supplies_gauge, + 'hpilo_power_supplies_detail_gauge': hpilo_power_supplies_detail_gauge, + 'hpilo_power_supplies_reading_gauge': hpilo_power_supplies_reading_gauge, 'hpilo_processor_gauge': hpilo_processor_gauge, + 'hpilo_processor_detail_gauge': hpilo_processor_detail_gauge, 'hpilo_network_gauge': hpilo_network_gauge, 'hpilo_temperature_gauge': hpilo_temperature_gauge, + 'hpilo_temperature_detail_gauge': hpilo_temperature_detail_gauge, 'hpilo_firmware_version': hpilo_firmware_version, + 'hpilo_nic_status_gauge': hpilo_nic_status_gauge, }