oracledb_exporter icon indicating copy to clipboard operation
oracledb_exporter copied to clipboard

How to get Prometheus hexadecimal label value instead of decimal value?

Open timeforplanb123 opened this issue 3 years ago • 0 comments

custom-metrics.toml

[[metric]]
context = "user_data"
labels = [ "mac_addr" ]
metricsdesc = { status_flag = "status_flag." }
request = "SELECT mac_addr,status_flag FROM user_data"

oracle SQL Developer query result

select * from user_data
+----------------+----------------+
| MAC_ADDR       | STATUS_FLAG    |
+----------------+----------------+
| 7085C2A7A6B2   | 1              |
+----------------+----------------+

mac_addr is a raw status_flag is a number

sudo systemctl status oracledb_exporter

sudo systemctl status oracledb_exporter starts well:

Jul 28 14:38:28 prometheus systemd[1]: Starting Service for oracle telemetry client...

Current Prometheus metrics and question

# my_prometheus:9161/metrics
# HELP oracledb_user_data_status_flag status_flag.
# TYPE oracledb_user_data_status_flag gauge
oracledb_user_data_status_flag{mac_addr="[112 133 194 167 166 178]"} 1

Why is mac_addr label in decimal format here and how to get / convert it to original hexadecimal? (7085C2A7A6B2 hex = 112 133 194 167 166 178 dec). In advance, thanks a lot for the answer.

timeforplanb123 avatar Jul 28 '22 11:07 timeforplanb123