Grafana v9.5.1
I am trying to join two prometheus queries:
windows_disk_drive_info{instance=~"$server"}
device_id |
model |
name |
PHYSICALDRIVE0 |
Samsung SSD 860 EVO 250GB |
\\.\PHYSICALDRIVE0 |
PHYSICALDRIVE1 |
KINGSTON SNVS2000GB |
\\.\PHYSICALDRIVE1 |
windows_disk_drive_status{instance=~"$server"}
name |
status |
Value |
PHYSICALDRIVE0 |
Degraded |
0 |
PHYSICALDRIVE0 |
Error |
0 |
PHYSICALDRIVE0 |
OK |
1 |
PHYSICALDRIVE1 |
Degraded |
0 |
PHYSICALDRIVE1 |
Error |
1 |
PHYSICALDRIVE1 |
OK |
0 |
Excepted output is
Model |
Status |
KINGSTON SNVS2000GB |
Error |
Samsung SSD 860 EVO 250GB |
Ok |
So before using “Transform Join by field”, I need to fix value of “name” field in query #A. I need to convert \\.\PHYSICALDRIVE0 → PHYSICALDRIVE0 by removing \\.\
I am new to grafana and don’t know what to do.
How about the Organize fields transformation?
Before organizing fields, need to join by field.
Problem is that field name of two queries should be the same.
- Fix query by renaming field.
label_replace(windows_disk_drive_status{instance=~"$server"}==1,"device_id","$1","name", "(.+)")
Now we have device_id field in both queries
name |
status |
Value |
device_id |
PHYSICALDRIVE0 |
OK |
1 |
PHYSICALDRIVE0 |
PHYSICALDRIVE1 |
Error |
1 |
PHYSICALDRIVE1 |
device_id |
model |
name |
PHYSICALDRIVE0 |
Samsung SSD 860 EVO 250GB |
\.\PHYSICALDRIVE0 |
PHYSICALDRIVE1 |
KINGSTON SNVS2000GB |
\.\PHYSICALDRIVE |
- Join by field “device_id”
- finally organize fields leaving only model and status
@aldarcass
The above has been marked as solution. Is your problem indeed solved by using the Organize Fields transformation?
My problem solved by 3 steps,
- replacing field (query)
- join field
- organize fields