【问题标题】:How to setup prometheus, grafana and blackbox_exporter for ping lost rate如何设置 prometheus、grafana 和 blackbox_exporter 的 ping 丢失率
【发布时间】:2017-03-22 09:18:38
【问题描述】:

我正在尝试使用 prometheus、grafana 和 blackbox_exporter 通过 ping(icmp) 监控我的服务器。我们最近遇到网络不稳定,但我的设置无法显示警报。我想知道我应该使用“probe_duration_seconds”还是其他探测方法?

grfana setting Metrics: probe_duration_seconds 和Panel数据源是prometheus

blackbox.yml:

modules:
  icmp:                                                                                                                                                                                       
    prober: icmp                                                                                                                                                                              
    timeout: 5s                                                                                                                                                                               
    icmp:                                                                                                                                                                                     
      protocol: "icmp"                                                                                                                                                                        
      preferred_ip_protocol: "ip4"                       

prometheus.yml:

global:                                                                                                                                                                                       
  scrape_interval:     15s                                                                                                                                                                                                  
  external_labels:                                                                                                                                                                            
    monitor: 'codelab-monitor'                                                                                                                                                                
scrape_configs:                                                                                                                                                                               
  - job_name: 'blackbox'                                                                                                                                                                      
    scrape_interval: 5s                                                                                                                                                                       
    metrics_path: /probe                                                                                                                                                                      
    params:                                                                                                                                                                                   
      module: [icmp] #ping                                                                                                                                                                    
    static_configs:                                                                                                                                                                           
      - targets: ['192.168.1.29']                                                                                                                                                            
        labels:                                                                                                                                                                               
          group: 'env A'                                                                                                                                                                   
      - targets: ['192.168.2.185', '192.168.3.185', '192.168.4.185']                                           
        labels:                                                                                                                                                                               
          group: 'env B' 
    relabel_configs:                                                                                                                                                                          
      - source_labels: [__address__]                                                                                                                                                          
        regex: (.*)(:80)?                                                                                                                                                                     
        target_label: __param_target                                                                                                                                                          
        replacement: ${1}                                                                                                                                                                     
      - source_labels: [__param_target]                                                                                                                                                       
        regex: (.*)                                                                                                                                                                           
        target_label: instance                                                                                                                                                                
        replacement: ${1}                                                                                                                                                                     
      - source_labels: []                                                                                                                                                                     
        regex: .*                                                                                                                                                                             
        target_label: __address__                                                                                                                                                             
        replacement: 127.0.0.1:9115

【问题讨论】:

    标签: grafana prometheus


    【解决方案1】:

    probe_success 将是 1/0,具体取决于 ping 是否成功。

    【讨论】:

    • 就我而言,我手动输入了“ping 192.168.2.185”,结果丢失了 25%。有没有更好的方法?
    • 浏览了blackbox_explorer的源码后,发现好像只有两个变量can audio,probe_success和probe_duration_seconds
    • 我发现probe_success的值都是0,所以也没用。 :(
    • @DanielYCLin 那么听起来从你的出口商到你的目标是不可能的。您可能希望运行其他导出器以从其他位置获取指标,以了解您的站点可能无法使用的位置。如果您不想自己运行它们,可以使用我的服务:latency.at
    猜你喜欢
    • 1970-01-01
    • 2021-03-26
    • 2022-01-02
    • 2019-04-17
    • 1970-01-01
    • 2013-01-19
    • 2021-06-13
    • 1970-01-01
    • 2017-06-20
    相关资源
    最近更新 更多