0

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

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

我的普罗米修斯配置看起来像

- 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 错误请求”我错过了什么吗?

4

3 回答 3

0

尝试这个:

- job_name: ldap_check
  metrics_path: /probe
  static_configs:
    - labels:
        module: tcp_connect
      targets:
        - global.ldap:636
  relabel_configs:
  ...
于 2021-05-20T18:29:44.293 回答
0

为此使用 TCP 模块。

tcp_connect:
    prober: tcp
    timeout: 5s

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

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

这篇文章详细介绍了这一点。如何设置 Prometheus BlackBox 导出器

于 2021-10-10T14:21:06.367 回答
0

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

有一种方法可以运行调试查询并确定出了什么问题。只需curl http://blackbox_exporter_ip:9115/probe使用与 Prometheus 相同的 URL 参数 plus 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"
于 2021-09-13T13:25:44.940 回答