我有两个 PiHole 实例,我试图在一个 Grafana 显示器中显示它们的统计数据。Prometheus 被用于存储 PiHole 数据。
我有一个名为“pihole_top_ads”的 Prometheus 指标,我可以从 Grafana 成功调用它,并以条形图格式显示每个 PiHole 实例返回的每个域和计数。我可以使用 Grafana 中的“混合”选项将其中两个组合起来,但这不会合并两个结果,它只列出第一组然后是第二组。不合并重复的域,这是我想要实现的。
我得到什么:
Domain "A - as seen by PiHole 1" count
Domain "B - as seen by PiHole 1" count
Domain "C - as seen by PiHole 1" count
Domain "D - as seen by PiHole 1" count
Domain "B - as seen by PiHole 2" count
Domain "D - as seen by PiHole 2" count
Domain "E - as seen by PiHole 2" count
Domain "F - as seen by PiHole 2" count
我想要的是:
Domain "A - as seen by PiHole 1" count
Domain "B - as seen by PiHole 1 and 2" total count
Domain "C - as seen by PiHole 1" count
Domain "D - as seen by PiHole 1 and 2" total count
Domain "E - as seen by PiHole 2" count
Domain "F - as seen by PiHole 2" count
这是 Prometheus 函数的返回示例:
pihole_top_ads{domain="api.mixpanel.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
3
pihole_top_ads{domain="brahe.apptimize.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
1
pihole_top_ads{domain="fls-na.amazon.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
1
pihole_top_ads{domain="g.live.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
10
pihole_top_ads{domain="g.msn.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
22
pihole_top_ads{domain="go.redirectingat.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
1
pihole_top_ads{domain="graph.accountkit.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
2
pihole_top_ads{domain="self.events.data.microsoft.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
4
pihole_top_ads{domain="ssl.google-analytics.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
1
pihole_top_ads{domain="trace.svc.ui.com", hostname="192.168.11.87", instance="localhost:9617", job="pihole"}
4
我在条形图 Grafana 面板中执行此操作,如下所示: Grafana 面板
通知 (self.events.data.microsoft.com) 出现两次。我希望合并这样的条目,并将所有条目排序在一起。
任何帮助将不胜感激。