首页 > 解决方案 > 如何在 Grafana 标题或 Y 轴上添加标签值?

问题描述

我使用 Prometheus + snmp_exporter + grafana 来监控设备,并将 $hrStorageIndex 设置为重复以绘制使用的每个存储。

如何在每个面板标题或 Y 轴中添加 $hrStorageDescr ?

snmp_exporter 数据如下:

HELP hrStorageAllocationUnits 从该池中分配的数据对象的大小(以字节为单位) - 1.3.6.1.2.1.25.2.3.1.4
TYPE hrStorageAllocationUnits 仪表
hrStorageAllocationUnits{hrStorageIndex="1"} 1024  
hrStorageAllocationUnits{hrStorageIndex="10"} 1024  
hrStorageAllocationUnits{hrStorageIndex="3"} 1024  
hrStorageAllocationUnits{hrStorageIndex="31"} 1024  
hrStorageAllocationUnits{hrStorageIndex="32"} 4096  
hrStorageAllocationUnits{hrStorageIndex="33"} 1024  
hrStorageAllocationUnits{hrStorageIndex="34"} 4096  
hrStorageAllocationUnits{hrStorageIndex="6"} 1024  
hrStorageAllocationUnits{hrStorageIndex="7"} 1024  
hrStorageAllocationUnits{hrStorageIndex="8"} 1024  
HELP hrStorageDescr 此条目描述的存储的类型和实例的描述。- 1.3.6.1.2.1.25.2.3.1.3
TYPE hrStorageDescr 仪表
hrStorageDescr{hrStorageDescr="/",hrStorageIndex="31"} 1
hrStorageDescr{hrStorageDescr="/etc/log",hrStorageIndex="34"} 1
hrStorageDescr{hrStorageDescr="/etc/mnt",hrStorageIndex="33"} 1
hrStorageDescr{hrStorageDescr="/sys/fs/cgroup/cpuset",hrStorageIndex="32"} 1
hrStorageDescr{hrStorageDescr="Cached memory",hrStorageIndex="7"} 1
hrStorageDescr{hrStorageDescr="Memory buffers",hrStorageIndex="6"} 1
hrStorageDescr{hrStorageDescr="Physical memory",hrStorageIndex="1"} 1
hrStorageDescr{hrStorageDescr="Shared memory",hrStorageIndex="8"} 1
hrStorageDescr{hrStorageDescr="Swap space",hrStorageIndex="10"} 1
hrStorageDescr{hrStorageDescr="Virtual memory",hrStorageIndex="3"} 1
HELP hrStorageIndex 主机包含的每个逻辑存储区域的唯一值。- 1.3.6.1.2.1.25.2.3.1.1
TYPE hrStorageIndex 仪表
hrStorageIndex{hrStorageIndex="1"} 1
hrStorageIndex{hrStorageIndex="10"} 10
hrStorageIndex{hrStorageIndex="3"} 3
hrStorageIndex{hrStorageIndex="31"} 31
hrStorageIndex{hrStorageIndex="32"} 32
hrStorageIndex{hrStorageIndex="33"} 33
hrStorageIndex{hrStorageIndex="34"} 34
hrStorageIndex{hrStorageIndex="6"} 6
hrStorageIndex{hrStorageIndex="7"} 7
hrStorageIndex{hrStorageIndex="8"} 8
HELP hrStorageSize 此条目表示的存储大小,单位为 hrStorageAllocationUnits - 1.3.6.1.2.1.25.2.3.1.5
TYPE hrStorageSize 规
hrStorageSize{hrStorageIndex="1"} 947676  
hrStorageSize{hrStorageIndex="10"} 0  
hrStorageSize{hrStorageIndex="3"} 947676  
hrStorageSize{hrStorageIndex="31"} 115157  
hrStorageSize{hrStorageIndex="32"} 0  
hrStorageSize{hrStorageIndex="33"} 45478  
hrStorageSize{hrStorageIndex="34"} 3.746398e+06  
hrStorageSize{hrStorageIndex="6"} 947676  
hrStorageSize{hrStorageIndex="7"} 177976  
hrStorageSize{hrStorageIndex="8"} 10836  
HELP hrStorageType 此条目表示的存储类型。- 1.3.6.1.2.1.25.2.3.1.2
TYPE hrStorageType 仪表
hrStorageType{hrStorageIndex="1",hrStorageType="1.3.6.1.2.1.25.2.1.2"} 1  
hrStorageType{hrStorageIndex="10",hrStorageType="1.3.6.1.2.1.25.2.1.3"} 1  
hrStorageType{hrStorageIndex="3",hrStorageType="1.3.6.1.2.1.25.2.1.3"} 1  
hrStorageType{hrStorageIndex="31",hrStorageType="1.3.6.1.2.1.25.2.1.4"} 1  
hrStorageType{hrStorageIndex="32",hrStorageType="1.3.6.1.2.1.25.2.1.4"} 1  
hrStorageType{hrStorageIndex="33",hrStorageType="1.3.6.1.2.1.25.2.1.4"} 1  
hrStorageType{hrStorageIndex="34",hrStorageType="1.3.6.1.2.1.25.2.1.4"} 1  
hrStorageType{hrStorageIndex="6",hrStorageType="1.3.6.1.2.1.25.2.1.1"} 1  
hrStorageType{hrStorageIndex="7",hrStorageType="1.3.6.1.2.1.25.2.1.1"} 1  
hrStorageType{hrStorageIndex="8",hrStorageType="1.3.6.1.2.1.25.2.1.1"} 1  
HELP hrStorageUsed 此条目表示的已分配存储量,以 hrStorageAllocationUnits 为单位。- 1.3.6.1.2.1.25.2.3.1.6
TYPE hrStorageUsed 量规
hrStorageUsed{hrStorageIndex="1"} 803248  
hrStorageUsed{hrStorageIndex="10"} 0  
hrStorageUsed{hrStorageIndex="3"} 803248  
hrStorageUsed{hrStorageIndex="31"} 57812  
hrStorageUsed{hrStorageIndex="32"} 0  
hrStorageUsed{hrStorageIndex="33"} 2172  
hrStorageUsed{hrStorageIndex="34"} 2.825416e+06  
hrStorageUsed{hrStorageIndex="6"} 69612  
hrStorageUsed{hrStorageIndex="7"} 177976  
hrStorageUsed{hrStorageIndex="8"} 10836  

标签: prometheusgrafanasnmp

解决方案


推荐阅读