简述
Prometheus提供了一个blackbox_exporter可以实现网络监控,支持http、dns、tcp、icmp等监控
二进制包部署
下载地址:https://prometheus.io/download/
[root@iZ8vb623n6mbyx9d66w0a9Z tmp]# tar -xzvf blackbox_exporter-0.22.0.linux-amd64.tar.gz -C /usr/local/ [root@iZ8vb623n6mbyx9d66w0a9Z tmp]# mv /usr/local/blackbox_exporter-0.22.0.linux-amd64 /usr/local/prometheus/blackbox_exporter
启动脚本
[root@iZ8vb623n6mbyx9d66w0a9Z tmp]# vim /usr/lib/systemd/system/blackbox_exporter.service [Unit] Description=blackbox_exporter After=network.target After=syslog.target [Service] ExecStart=/usr/local/prometheus/blackbox_exporter/blackbox_exporter --config.file=/usr/local/prometheus/blackbox_exporter/blackbox.yml [Install] WantedBy=multi-user.target
启动服务
[root@iZ8vb623n6mbyx9d66w0a9Z tmp]# systemctl enable blackbox_exporter.service Created symlink from /etc/systemd/system/multi-user.target.wants/blackbox_exporter.service to /usr/lib/systemd/system/blackbox_exporter.service. [root@iZ8vb623n6mbyx9d66w0a9Z tmp]# systemctl start blackbox_exporter.service [root@iZ8vb623n6mbyx9d66w0a9Z tmp]# systemctl status blackbox_exporter.service ● blackbox_exporter.service - blackbox_exporter Loaded: loaded (/usr/lib/systemd/system/blackbox_exporter.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2022-11-22 17:49:09 CST; 8s ago Main PID: 12975 (blackbox_export) CGroup: /system.slice/blackbox_exporter.service └─12975 /usr/local/prometheus/blackbox_exporter/blackbox_exporter --config.file=/usr/local/prometheus/blackbo... Nov 22 17:49:09 iZ8vb623n6mbyx9d66w0a9Z systemd[1]: Started blackbox_exporter. Nov 22 17:49:09 iZ8vb623n6mbyx9d66w0a9Z blackbox_exporter[12975]: ts=2022-11-22T09:49:09.655Z caller=main.go:256 leve...0)" Nov 22 17:49:09 iZ8vb623n6mbyx9d66w0a9Z blackbox_exporter[12975]: ts=2022-11-22T09:49:09.655Z caller=main.go:257 leve...0)" Nov 22 17:49:09 iZ8vb623n6mbyx9d66w0a9Z blackbox_exporter[12975]: ts=2022-11-22T09:49:09.656Z caller=main.go:269 leve...le" Nov 22 17:49:09 iZ8vb623n6mbyx9d66w0a9Z blackbox_exporter[12975]: ts=2022-11-22T09:49:09.656Z caller=main.go:417 leve...115 Nov 22 17:49:09 iZ8vb623n6mbyx9d66w0a9Z blackbox_exporter[12975]: ts=2022-11-22T09:49:09.656Z caller=tls_config.go:19...lse Hint: Some lines were ellipsized, use -l to show in full.
继续阅读
评论