0.数据抓取的生命周期

prometheus服务发现 + Prometheus 查询说明 + 正则模糊查询_正则

1.通过文件发现

- job_name: node

  file_sd_configs:

  - targets/nodes/*.json

  reflesh_interval: 5m

 

prometheus服务发现 + Prometheus 查询说明 + 正则模糊查询_html_02

2.添加标签

prometheus服务发现 + Prometheus 查询说明 + 正则模糊查询_node.js_03

cat ./node/node.json
[{"targets":["10.0.0.111:9100"],
"labels":{"instance":"node_111"}},
{"targets":["10.0.0.134:9100"],
"labels":{"datacenter":"node_134"}}
]

 3.正则模糊查询

up{myjob=~"node119.*"}

rate(node_network_receive_bytes_total{myjob=~"node119.*",device="eth0"}[1m])

  Prometheus学习系列(六)之Prometheus 查询说明

用一个例子来演示会更加清晰