[英]left join prometheus metrics in grafana?
I'm using prometheus in grafana to track smart data for drives in a couple servers.我在 grafana 中使用 prometheus 来跟踪几个服务器中驱动器的智能数据。 I'm trying to create a table that shows me which drives have >0 reallocated sectors... here are the queries i use:
我正在尝试创建一个表,显示哪些驱动器具有 >0 重新分配的扇区...这是我使用的查询:
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 中使用外连接按磁盘合并两个查询,但问题是该表最终显示所有驱动器,而不仅仅是重新分配扇区 >0 的驱动器(目前只有 /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?
Grafana 还没有左连接选项,只有外连接,所以我不确定这是否可能......是吗?
I think I solved it, with help from:我想我解决了它,在以下方面的帮助下:
https://www.section.io/blog/prometheus-querying/ https://www.section.io/blog/prometheus-querying/
and和
How can I 'join' two metrics in a Prometheus query? 如何在 Prometheus 查询中“加入”两个指标?
(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)似乎做了一个正确的连接,导致只有一行(现在)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.