首页 > Web开发 > 详细

用Blackbox Exporter to Monitor web和端口

时间:2019-10-14 19:41:08      阅读:253      评论:0      收藏:0      [点我收藏+]

1.按照exporter

1.wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.12.0/blackbox_exporter-0.12.0.linux-amd64.tar.gz
2.tar -zxf blackbox_exporter-0.12.0.linux-amd64.tar.gz
3.mv blackbox_exporter-0.14.0.linux-amd64 /usr/local/blackbox_exporter
4../blackbox_exporter --version

2.vim /lib/systemd/system/blackbox_exporter.service   --  变成系统服务 netstat -anptu|grep 9115

[Unit]
Description=blackbox_exporter
After=network.target

[Service]
User=root
Type=simple
ExecStart=/usr/local/blackbox_exporter/blackbox_exporter --config.file=/usr/local/blackbox_exporter/blackbox.yml
Restart=on-failure

[Install]
WantedBy=multi-user.target

3.监控web和端口状态

  - job_name: web_status
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets: [http://192.168.1.49:8080/]
        labels:
          instance: web_status
          group: web
      - targets: [https://www.baidu.com/]
        labels:
          instance: baidu_status
          group: baidu
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - target_label: __address__
        replacement: 127.0.0.1:9115
  - job_name: port_status
    metrics_path: /probe
    params:
      module: [tcp_connect]
    static_configs:
      - targets: [192.168.1.49:8080]
        labels:
          instance: port_status
          group: tcp
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target

      - target_label: __address__
        replacement: 127.0.0.1:9115

4.dashboard  -- 9665 和 7587

5.参考:https://blog.csdn.net/qq_43190337/article/details/100577728

用Blackbox Exporter to Monitor web和端口

原文:https://www.cnblogs.com/hixiaowei/p/11673158.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!