Prometheus监控url

安装blackbox_exporter

blackbox exporter是允许在HTTP, HTTPS, DNS, TCP and ICMP等协议的端点进行黑盒探测的采取器 官方github: https://github.com/prometheus/blackbox_exporter

1
2
3
4
5
wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.14.0/blackbox_exporter-0.14.0.linux-amd64.tar.gz

tar -zxvf blackbox_exporter-0.14.0.linux-amd64.tar.gz
mv blackbox_exporter-0.14.0.linux-amd64 blackbox_exporter
nohup ./blackbox_exporter --config.file=/usr/local/blackbox_exporter/blackbox.yml &

prometheus配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
- job_name: 'blackbox'
metrics_path: /probe
params:
module: [http_2xx] # Look for a HTTP 200 response.
static_configs:
- targets:
- http://192.168.7.107:3000/login/
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 192.168.7.107:9115 # The blackbox exporter's real hostname:port.

grafana模板

1
https://grafana.com/grafana/dashboards/7587

Donate