prometheus服务发现-不同场景下的service注册参数

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

普通场景

{
  "ID": "2",
  "Name": "exporter-vcenter-ping",
  "Tags": [
    "vcenter"
  ],
  "Address": "10.60.82.168",
  "Port": 3871,
  "Meta": {
    "component": "vcenter_ping",
  }
}

此service注册到prometheus后,抓取的链接为http://10.60.82.168:3871/metrics

重写metric path

prometheus中的metric path主要是靠label中__metrics_path__来确定,默认为/metrics

{
  "ID": "2",
  "Name": "exporter-vcenter-ping",
  "Tags": [
    "normal"
  ],
  "Address": "10.60.82.168",
  "Port": 3871,
  "Meta": {
    "component": "vcenter_ping",
    "__metrics_path__":"/metrics/vcenter_ping"
  }
}

此service注册到prometheus后,抓取的链接为http://10.60.82.168:3871/metrics/vcenter_ping

blackbox

{
  "ID": "2",
  "Name": "http-vcenter",
  "Tags": [
    "normal"
  ],
  "Address": "127.0.0.1",
  "Port": 9115,
  "Meta": {
    "component": "vcenter_ping",
    "__metrics_path__":"/probe",
    "__param_target":"http://127.0.0.1:18500",
    "__param_module":"http_2xx"
  }
}

此service注册到prometheus后,抓取的链接为http://10.106.169.121:9115/probe?module=http_2xx&target=http%3A%2F%2F127.0.0.1%3A18500

prometheus服务发现-不同场景下的service注册参数_第1张图片

转载于:https://my.oschina.net/sannychan/blog/3011526

你可能感兴趣的:(prometheus服务发现-不同场景下的service注册参数)