云服务器

网路质量监控与告警

2020-05-25 10:45:17 88

网络监控是运维工作之一,如何搭建高效可扩展的可视化网络监控成为运维工程师的一项重要技能,此篇文章讲介绍如何快速使用搭建一个网络质量可视化平台。

1.Prometheus 与Blackbox_exporter黑盒监测ICMP

1.1docker部署prometheus

docker run -p 9090:9090  -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml     prom/prometheus
#下载并解压blackbox_exporter黑盒探针压缩文件
wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.16.0/blackbox_exporter-0.16.0.linux-amd64.tar.gz
tar -zxvf blackbox_exporter-0.16.0.linux-amd64.tar.gz
cd blackbox_exporter-0.16.0.linux-amd64

#blackbox.yml文件如下

modules: http_2xx: prober: http http_post_2xx: prober: http http: method: POST tcp_connect: prober: tcp pop3s_banner: prober: tcp tcp: query_response: - expect: "^+OK" tls: true tls_config: insecure_skip_verify: false ssh_banner: prober: tcp tcp: query_response: - expect: "^SSH-2.0-" irc_banner: prober: tcp tcp: query_response: - send: "NICK prober" - send: "USER prober prober prober :prober" - expect: "PING :([^ ]+)" send: "PONG ${1}" - expect: "^:[^ ]+ 001" icmp: prober: icmp ------------------------- #启动黑盒探针 ./blackbox_exporter --config.file="blackbox.yml" --log.level=error &


1.2 配置prometheus

scrape_configs:
  - job_name: 'blackboxi_icmp'
    metrics_path: /probe
    scrape_interval: 5s
    params:
      module: [icmp]
    static_configs:
      - targets:
         - IP1
         - IP2
         - IP3
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        #blackbox exporter 所在节点
        replacement: 172.17.0.1:9115


重启prometheus 的docker容器使其生效

下载grafana并添加数据源

docker run -d --name=grafana -p 3000:3000 grafana/grafana

 

最后导入面板的json文件

https://grafana.com/grafana/dashboards/7587这里有现成的面板模板


 

导入后就能看到监控IP的延时数据了

睿江云官网链接:www.eflycloud.com

上一篇: 无

微信关注

获取更多技术咨询