file_sd_config 参看:
详解Prometheus自动发现之file_sd_config_宫凯宁的博客-CSDN博客_file_sd_config
但是会报错:
prometheus | ts=2022-10-12T08:46:45.685Z caller=file.go:337 level=error component="discovery manager scrape" discovery=file msg="Error reading file" path=/etc/prometheus/sd_conf/mros.json err="json: unknown field \"metrics_path\""
解决办法参看:
labels中添加:
__metrics_path__
如:
{
"targets": [
"12.3.33.13:9020"
],
"labels": {
"node_name": "micros-pa",
"__metrics_path__": "/pay/actuator/prometheus",
"idc": "RUC"
}
}