需求:使用监控插件名称:bloackbox exporterbloackbox exporter 是prometheus社区提供的黑盒监控解决方案 , 运行用户通过HTTP、HTTPS、DNS、TCP以及ICMP的方式对网络进行探测(主动监测主机与服务状态) 。
一、下载安装包部署wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.16.0/blackbox_exporter-0.16.0.linux-amd64.tar.gztar zxvf blackbox_exporter-0.16.0.linux-amd64.tar.gzmkdir /usr/local/exportermv blackbox_exporter-0.16.0.linux-amd64 /usr/local/exporter/blackbox_exporter/usr/local/exporter/blackbox_exporter/blackbox_exporter--config.file=/usr/local/exporter/blackbox_exporter/blackbox.yml
配置文件
modules:http_2xx:prober: httphttp_post_2xx:prober: httphttp:method: POSTtcp_connect:prober: tcppop3s_banner:prober: tcptcp:query_response:- expect: "^+OK"tls: truetls_config:insecure_skip_verify: falsessh_banner:prober: tcptcp:query_response:- expect: "^SSH-2.0-"irc_banner:prober: tcptcp:query_response:- send: "NICK prober"- send: "USER prober prober prober :prober"- expect: "PING :([^ ]+)"send: "PONG ${1}"- expect: "^:[^ ]+ 001"icmp:prober: icmp
- 访问:http://XXXXXX:9115/
文章插图
- 制作system启动文件(可忽略)
[root@Prometheus exporter]#cd /usr/lib/systemd/system# 配置blackbox的开机自启文件[root@Prometheus system]# cat blackbox_exporter.service [Unit]Description=blackbox_exporterAfter=network.target [Service]User=prometheusGroup=prometheusWorkingDirectory=/usr/local/exporter/blackbox_exporterExecStart=/usr/local/exporter/blackbox_exporter/blackbox_exporter[Install]WantedBy=multi-user.target# 启动[root@node00 system]# systemctl restart blackbox_exporter# 查看状态[root@node00 system]# systemctl status blackbox_exporter# 开机自启[root@node00 system]# systemctl enable blackbox_exporter```
二、配置promethus采集数据 , 修改promethus-server配置文件 , 监控URL地址- 方法一 、修改promethus-server的配置文件,添加blackbox_http_2xx (url直接写在文件中)
/usr/local/prometheus/prometheus.yml
- job_name: 'blackbox_http_2xx'scrape_interval: 45smetrics_path: /probeparams:module: [http_2xx]# Look for a HTTP 200 response.static_configs:- targets:- https://www.baidu.com/- 172.0.0.1:9090- https://www.qq.comrelabel_configs:- source_labels: [__address__]target_label: __param_target- source_labels: [__param_target]target_label: instance- target_label: __address__replacement: 114.67.116.119:9115
重启动promethus服务展示最近监控信息
文章插图
- 方法二、修改promethus-server的配置文件,添加blackbox_http_2xx (url单独写一个规则文件)
/usr/local/prometheus/prometheus.yml
- job_name: "blackbox_http_file_test"metrics_path: /probeparams:module: [http_2xx]# Look for a HTTP 200 response.file_sd_configs:- refresh_interval: 1mfiles:- "/usr/local/prometheus/conf/blackbox*.yml"relabel_configs:- source_labels: [__address__]target_label: __param_target- source_labels: [__param_target]target_label: instance- target_label: __address__replacement: 114.67.116.119:9115
- URL规则文件
[root@node00 prometheus]# cat conf/blackbox-dis.yml - targets:- https://www.alibaba.com- https://www.tencent.com- https://www.baidu.com
重启动promethus服务三、grafana展示blackbox采集数据
- 1、 选择--》import-->通过导入9965 , 获取监控展示模板 。
文章插图
文章插图
- 2、站点监控 , 域名监控、域名到期监控展示
文章插图
【Promethues如何针对站点、SSL监控】
四、错误提示 Panel plugin not found: grafana-piechart-panel
文章插图
解决方法
[root@Prometheus ~]# grafana-cli plugins install grafana-piechart-panelinstalling grafana-piechart-panel @ 1.4.0from: https://grafana.com/api/plugins/grafana-piechart-panel/versions/1.4.0/downloadinto: /var/lib/grafana/plugins? Installed grafana-piechart-panel successfully Restart grafana after installing plugins . <service grafana-server restart>
推荐阅读
- 前后 如何使用JavaScript访问设备摄像头
- Excel中如何输入特殊的字符?如勾、叉、平方、立方等
- 传说中的“洋葱头Tor”是如何做到匿名通信的?
- 找淘客推广需要注意什么 什么是淘客?如何操作?
- 如何在显示器上使用USB接口
- 淘宝运营怎么做数据分析 淘宝如何分析产品数据
- 华为、Cisco、H3C、中兴网络设备如何配置syslog日志采集
- 淘宝新开店铺怎么推广比较好 如何推广淘宝店铺如何运营
- 办公室|教你如何调整办公室风水摆设与布局
- 淘宝差评能删除吗?碰到差评该如何处理? 淘宝差评可以用什么办法删除