如何使用blackbox_exporter检查特定的tcp端口是否可用?

问题描述 投票:0回答:1

我想检查Oracle数据库服务器上tcp端口1521的可用性。

但是probe_success显示为0,尽管该端口可用。目标不正确?

我的配置prometheus。

  - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: ['http_2xx', 'tcp_connect']  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - 172.27.1.8:1521 # Target to probe with http on port 1521.
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 172.27.1.54:9115  

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
prometheus prometheus-blackbox-exporter
1个回答
0
投票
 module: ['http_2xx', 'tcp_connect']  # Look for a HTTP 200 response.

模块URL参数只接受一个参数,因此您需要:

  module: ['tcp_connect']
© www.soinside.com 2019 - 2024. All rights reserved.