Browse Source

Support for metrics description

This patch adds the capability to add a description for the ipmi
metrics.

The description are based on [1]

[1] https://www.intel.com/content/www/us/en/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html

Change-Id: Ic21a778b06456140ac5dbbec0e44271c72d80b29
changes/45/675345/6
Iury Gregory Melo Ferreira 1 month ago
parent
commit
5398f864f1

+ 15
- 3
ironic_prometheus_exporter/parsers/ipmi.py View File

@@ -10,7 +10,9 @@
10 10
 #    License for the specific language governing permissions and limitations
11 11
 #    under the License.
12 12
 
13
+import json
13 14
 import logging
15
+import pkg_resources
14 16
 import re
15 17
 
16 18
 from datetime import datetime
@@ -71,6 +73,11 @@ CATEGORY_PARAMS = {
71 73
 }
72 74
 
73 75
 
76
+IPMI_JSON = pkg_resources.resource_filename(__name__,
77
+                                            "metrics_information/ipmi.json")
78
+IPMI_METRICS_DESCRIPTION = json.load(open(IPMI_JSON))
79
+
80
+
74 81
 def metric_names(category_info):
75 82
     LOG.info('metric_names function called with data=%s' % str(category_info))
76 83
 
@@ -214,7 +221,8 @@ def prometheus_format(category_info, ipmi_metric_registry, available_metrics):
214 221
         values = extract_values(entries, category_info)
215 222
         if all(v is None for v in values.values()):
216 223
             continue
217
-        g = Gauge(metric, '', labelnames=labels.get(entries[0]).keys(),
224
+        g = Gauge(metric, get_metric_description(metric),
225
+                  labelnames=list(labels.get(entries[0])),
218 226
                   registry=ipmi_metric_registry)
219 227
         for e in entries:
220 228
             if values[e] is None:
@@ -244,6 +252,10 @@ def timestamp_registry(node_information, ipmi_metric_registry):
244 252
     dt_timestamp = datetime.strptime(node_information['timestamp'],
245 253
                                      '%Y-%m-%dT%H:%M:%S.%f')
246 254
     value = int((dt_timestamp - dt_1970).total_seconds())
247
-    g = Gauge(metric, 'Timestamp of the last received payload',
248
-              labelnames=labels.keys(), registry=ipmi_metric_registry)
255
+    g = Gauge(metric, get_metric_description(metric),
256
+              labelnames=list(labels), registry=ipmi_metric_registry)
249 257
     g.labels(**labels).set(value)
258
+
259
+
260
+def get_metric_description(metric_name):
261
+    return IPMI_METRICS_DESCRIPTION.get(metric_name, '')

+ 96
- 0
ironic_prometheus_exporter/parsers/metrics_information/ipmi.json View File

@@ -0,0 +1,96 @@
1
+{
2
+    "baremetal_front_led_panel":
3
+        "The System Board Management Subsys Health",
4
+    "baremetal_temp_celsius":
5
+        "The temperature of each Processor",
6
+    "baremetal_exhaust_temp_celsius":
7
+        "The exhaust temperature for the Systeam Board",
8
+    "baremetal_inlet_temp_celsius":
9
+        "The inlet temperature for the Systeam Board",
10
+    "baremetal_system_unknown":
11
+        "Unknown System Event",
12
+    "baremetal_system_post_err":
13
+        "The System Firmware progress",
14
+    "baremetal_current":
15
+        "Current power supply",
16
+    "baremetal_pwr_consumption":
17
+        "Current power consumption",
18
+    "baremetal_tpm_presence":
19
+        "Indicates if the Trusted Platform Module is present",
20
+    "baremetal_hdwr_version_err":
21
+        "Indicates if there is a hardware version error",
22
+    "baremetal_chassis_mismatch":
23
+        "Indicates if there is a mismatch in the chassis information",
24
+    "baremetal_memory_ecc_corr_err":
25
+        "Status of the ECC Corr Err",
26
+    "baremetal_idpt_mem_fail":
27
+        "Status of the iDPT Mem Fail",
28
+    "baremetal_memory_ecc_uncorr_err":
29
+        "Status of the ECC Uncorr Err",
30
+    "baremetal_memory_mirrored":
31
+        "Status of the Memory Mirrored",
32
+    "baremetal_mem_ecc_warning":
33
+        "Status of the Mem ECC Warning",
34
+    "baremetal_memory_b":
35
+        "Status of the Memory B",
36
+    "baremetal_memory_a":
37
+        "Status of the Memory A",
38
+    "baremetal_memory_usb_over_current":
39
+        "Status of the USB Over-current",
40
+    "baremetal_memory_post_pkg_repair":
41
+        "Status of the POST Pkg Repair",
42
+    "baremetal_memory_spared":
43
+        "Status of the Memory Spared",
44
+    "baremetal_power_ps_redundancy":
45
+        "Indicates if there is redundancy for power supply",
46
+    "baremetal_power_status":
47
+        "Indicates the status of the power supply",
48
+    "baremetal_os_watchdog_time":
49
+        "watchdog timer expirations",
50
+    "baremetal_os_watchdog":
51
+        "Indicates if watchdog is enabled",
52
+    "baremetal_fan_redundancy":
53
+        "Indicates if fan redundancy is actived",
54
+    "baremetal_fan_rpm":
55
+        "Indicates the fan speed",
56
+    "baremetal_last_payload_timestamp_seconds":
57
+        "Timestamp of the last received payload",
58
+    "baremetal_voltage_mem_vtt_pg":
59
+        "Status of the MEM___ VTT PG",
60
+    "baremetal_voltage_sw_pg":
61
+        "Status of the SW PG",
62
+    "baremetal_voltage_vsa_pg":
63
+        "Status of the VSA PG",
64
+    "baremetal_voltage_vcore_pg":
65
+        "Status of the VCORE PG",
66
+    "baremetal_voltage_volts":
67
+        "Indicates the voltage for the power supply",
68
+    "baremetal_voltage_dimm_pg":
69
+        "Status of the DIMM PG",
70
+    "baremetal_voltage_vsbm_sw_pg":
71
+        "Status of the VSBM SW PG",
72
+    "baremetal_voltage_ndc_pg":
73
+        "Status of the NDC PG",
74
+    "baremetal_voltage_ps_pg_fail":
75
+        "Status of the PS_ PG FAIL",
76
+    "baremetal_voltage_vccio_pg":
77
+        "Status of the VCCIO PG",
78
+    "baremetal_voltage_vsb_sw_pg":
79
+        "Status of the VSB__ SW PG",
80
+    "baremetal_voltage_mem_vddq_pg":
81
+        "Status of the MEM___ VDDQ PG",
82
+    "baremetal_voltage_bp_pg":
83
+        "Status of the BP PG",
84
+    "baremetal_voltage_a_pg":
85
+        "Status of the A PG",
86
+    "baremetal_voltage_fivr_pg":
87
+        "Status of the FIVR PG",
88
+    "baremetal_voltage_pvnn_sw_pg":
89
+        "Status of the PVNN SW PG",
90
+    "baremetal_voltage_mem_vpp_pg":
91
+        "Status of the MEM___ VPP PG",
92
+    "baremetal_voltage_pfault_fail_safe":
93
+        "Status of the Pfault Fail Safe",
94
+    "baremetal_voltage_b_pg":
95
+        "Status of the B PG"
96
+}

+ 4
- 0
releasenotes/notes/ipmi-metric-description-d670149bcd984a51.yaml View File

@@ -0,0 +1,4 @@
1
+---
2
+features:
3
+  - |
4
+    Adds support to add a description for each ipmi metric.

Loading…
Cancel
Save