我是grafana和prometheus的新手 . 我使用此帖子中的docker-compose.yml设置prometheus,grafana,alertmanager,nodeexporter和cadvisor https://github.com/vegasbrianc/prometheus
和进口的grafana仪表板#893起https://grafana.com/dashboards/893
但是仪表板不起作用,因为我在某些面板中看到N / A.例如下面是面板使用的查询,我无法弄清楚如何在查询中获取模板变量的值 . 我看了http://node-exporter:9100/metrics并没有看到变量的值'$server'
Query1: time() - node_boot_time{instance=~"$server:.*"}
Query2:min((node_filesystem_size_bytes{fstype=~"xfs|ext4",instance=~"$server:.*"} - node_filesystem_free_bytes{fstype=~"xfs|ext4",instance=~"$server:.*"} )/ node_filesystem_size_bytes{fstype=~"xfs|ext4",instance=~"$server:.*"})
我应该为node-exporter和prometheus配置什么来评估查询中的模板变量$ server?
1 回答
$server
是Grafana template variable . 这些通常显示为Grafana仪表板顶部的下拉列表 .label_values
是应用于Prometheus查询的Prometheus-specific Grafana function . 您的特定示例label_values(node_boot_time, instance)
将返回由Prometheus收集的所有node_boot_time
指标的instance
标签的所有值(即由Prometheus监控的所有节点导出程序目标) .我没有您正在使用的特定仪表板(或节点导出器)的经验,但通常是某些面板显示"N/A"或没有值而其他面板工作正常的原因是底层度量标准名称可能已更改 . 您可以单击Grafana中有问题的面板的 Headers ,选择“编辑”,然后单击“度量标准”选项卡以尝试不同的度量标准名称 . 对于"inspiration",请检查节点导出器的
/metrics
endpoints . 如果您不知道如何访问它,请在Prometheus Web界面上导航到Status> Targets并单击节点导出器的URL .