Prometheus + blackbox_exporter + grafana

A. Installation blackbox_exporter

In my essay there Baidu cloud link https://www.cnblogs.com/lc226/p/11222048.html

1. After downloading codecs nohup ./blackbox_exporter &

2. Review the output of tail -f nohup.out 

 

II. Configuration prometheus

1.vi prometheus.yml

2.

Icmp module ,, used here is the same problem yml to pay attention to the format of this document.

- job_name: 'ping'
metrics_path: /probe
params:
module: [icmp] # Look for icmp.
static_configs:
- targets: ['www.baidu.com','172.16.16.74','172.16.16.76']
relabel_configs: -------------------------------------------------------------------这个用法后面有空专门讲
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 172.16.16.80:9115 # The blackbox exporter's real hostname:port

 

 

3. Restart prometheus

4. Access http://172.16.16.80:9115/. . . . . Here 76 virtual machines that do not use

 If there is failure here you can go in and see what is the reason

For example, 76 units that went to see logs

 

 

 three. grafana show

Here is used probe_success this indicator, this indicator represents the detection success is a failure returns 0, shown here is grafana can design their own, specific back Available to explain some of the features in detail grafana

 

 

 

后面再附上http_2xx模块的配置,这个模块可以到测试端口,某一个url具体如下

- job_name: 'blackbox'
metrics_path: /probe
params:
module: [http_2xx] # Look for a HTTP 200 response.
static_configs:
- targets:
# - http://prometheus.io # Target to probe with http.
# - https://prometheus.io # Target to probe with https.
- http://172.16.16.76:80 # Target to probe with http on port 8080.
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port

 

Guess you like

Origin www.cnblogs.com/lc226/p/11222588.html