Prometheus提供的数据格式可以低级别发现使用
查看Prometheus检查的详细数据是如何在Zabbix中实现的。
低级发现规则应该作为监控项依赖创建到Prometheus数据的HTTP监控项中。
在发现规则中,进入Preprocessing选项卡,并选择Prometheus to JSON Preprocessing选项。发现需要JSON格式的数据,而Prometheus to JSON预处理选项将会返回正确的数据,包含以下属性:
例如,查询 wmi_logical_disk_free_bytes
:
从Prometheus获取数据:
# HELP wmi_logical_disk_free_bytes Free space in bytes (LogicalDisk.PercentFreeSpace)
# TYPE wmi_logical_disk_free_bytes gauge
wmi_logical_disk_free_bytes{volume="C:"} 3.5180249088e+11
wmi_logical_disk_free_bytes{volume="D:"} 2.627731456e+09
wmi_logical_disk_free_bytes{volume="HarddiskVolume4"} 4.59276288e+08
返回:
[
{
"name": "wmi_logical_disk_free_bytes",
"help": "Free space in bytes (LogicalDisk.PercentFreeSpace)",
"type": "gauge",
"labels": {
"volume": "C:"
},
"value": "3.5180249088e+11",
"line_raw": "wmi_logical_disk_free_bytes{volume=\"C:\"} 3.5180249088e+11"
},
{
"name": "wmi_logical_disk_free_bytes",
"help": "Free space in bytes (LogicalDisk.PercentFreeSpace)",
"type": "gauge",
"labels": {
"volume": "D:"
},
"value": "2.627731456e+09",
"line_raw": "wmi_logical_disk_free_bytes{volume=\"D:\"} 2.627731456e+09"
},
{
"name": "wmi_logical_disk_free_bytes",
"help": "Free space in bytes (LogicalDisk.PercentFreeSpace)",
"type": "gauge",
"labels": {
"volume": "HarddiskVolume4"
},
"value": "4.59276288e+08",
"line_raw": "wmi_logical_disk_free_bytes{volume=\"HarddiskVolume4\"} 4.59276288e+08"
}
]
接下来,你必须进入LLD宏标签,并创建以下映射:
你可能想要这样创建一个监控项原型:
与预处理选项: