2

I'm using Prometheus and I need to monitor multiple ports, but I couldn't find information about that. Blackbox exporter docs aren't enough because that only pertains to monitoring one port.

I'm using Ubuntu Server.

Thanks

1 Answer 1

0

It mostly depends on what you expect from the ports. If you just want to check if a port is open, you probably want to go with tcp prober. This one is configured in your blackbox.yml (like this):

modules:
[...]
  tcp_connect:
    prober: tcp
[...]

Now, you are able to make different checks using your prometheus.yml, like this:

scrape_configs:
[...]
  - job_name: 'my-tcp-probes'
    scrape_interval: 10s # whatever you want
    metrics_path: /probe # where your blackbox-exporter is running (see below)
    params:
      module: [tcp_connect] # most be equal to the one you configured in your blackbox.yml
    static_configs:
      - targets:
          - host0:1234
          - host1:22
          [...]
          - hostN:3389
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115 # host:port where blackbox exporter runs

Works fine for me. ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .