Reputation: 1244
I'm using prometheus in grafana to track smart data for drives in a couple servers. I'm trying to create a table that shows me which drives have >0 reallocated sectors... here are the queries i use:
sum(smartmon_reallocated_sector_ct_raw_value>0) by (disk)
sum(smartmon_device_info) by (device_model, disk, model_family, serial_number)
This results in a table like the following:
I'm using an outer join in grafana to merge the two queries by disk, but the problem is that the table ends up showing all drives, not just the ones with >0 reallocated sectors (currently only /dev/da8). Grafana doesn't yet have a left join option, only outer join, so I'm not sure if this is even possible...is it?
Upvotes: 2
Views: 8251
Reputation: 1244
I think I solved it, with help from:
https://www.section.io/blog/prometheus-querying/
and
How can I 'join' two metrics in a Prometheus query?
(sum(smartmon_reallocated_sector_ct_raw_value) by (disk) >0) * on(disk) group_right(device_model) sum(smartmon_device_info) by (device_model, disk, model_family, serial_number)
seems to do a right join, resulting in just a single row (for now)
Upvotes: 3