【问题标题】:Monitoring TCP endpoint using BlackBox exporter使用 BlackBox 导出器监控 TCP 端点
【发布时间】:2021-08-10 00:29:15
【问题描述】:

我正在尝试使用使用 tcp_connect 模块的黑盒导出器来探测我的 LDAP 服务器。来源是我的k8s集群。在我的集群中,我绝对可以访问 ldap 服务器

debug@debug:~$ telnet global.ldap 636
Trying 10.27.20.7...
Connected to global.ldap.
Escape character is '^]'.
^]

我的 Prometheus 配置看起来像

- job_name: 'ldap_check'
          scrape_interval: 5m
          metrics_path: /probe
          params:
            module: [tcp_connect]
          static_configs:
            - targets:
              - 'ldaps://global.ldap:636' # Also tried 'global.ldap:636' without the 'ldaps://'
          relabel_configs:
            - source_labels: [__address__]
              target_label: __param_target
            - source_labels: [__param_target]
              target_label: instance
            - target_label: __address__
              replacement: monitoring-prometheus-blackbox-exporter:9115

但我的 Prometheus /targets 页面显示“服务器返回 HTTP 状态 400 错误请求” 有什么我错过的吗?

【问题讨论】:

    标签: prometheus prometheus-blackbox-exporter


    【解决方案1】:

    试试这个:

    - job_name: ldap_check
      metrics_path: /probe
      static_configs:
        - labels:
            module: tcp_connect
          targets:
            - global.ldap:636
      relabel_configs:
      ...
    

    【讨论】:

      【解决方案2】:

      400 Bad Requestblackbox exporter 最可能的原因是缺少请求的module(在这种情况下为tcp_connect)。由于tcp_connect 是默认模块之一,我想有人修改了blackbox.yml 配置并忘记在其中包含默认模块。

      有一种方法可以运行调试查询并确定问题所在。只需 curl http://blackbox_exporter_ip:9115/probe 与 Prometheus 相同的 URL 参数加上 debug=true。例如:

      ❯ curl 'http://localhost:9115/probe?debug=true&module=tcp_connect2&target=localhost:9115' -v
      ...
      < HTTP/1.1 400 Bad Request
      ...
      Unknown module "tcp_connect2"
      

      【讨论】:

        【解决方案3】:

        为此使用 TCP 模块。

        tcp_connect:
            prober: tcp
            timeout: 5s
        

        像这样。 telnet 10.10.10.1 主机为 123 端口。

        curl 'http://localhost:9115/probe?target=10.10.10.1:123&module=tcp_connect&debut=true'

        这篇文章详细介绍了这一点。 How to setup Prometheus BlackBox exporter

        【讨论】:

          猜你喜欢
          • 2020-01-11
          • 1970-01-01
          • 2022-10-25
          • 1970-01-01
          • 2015-09-14
          • 2016-01-28
          • 2020-06-11
          • 1970-01-01
          • 2020-11-08
          相关资源
          最近更新 更多