Configuring tcp probes for blackbox-exporter

1,659 views
Skip to first unread message

IWWE

unread,
Jul 26, 2018, 3:48:43 AM7/26/18
to Prometheus Users
Hello,

I'm having trouble understanding how to configure tcp probes to service ports other than http servers.

Can someone give me an example how to probe a ssh-port?

I already successfully configured prom to probe http servers via blackbox-exporter:

  - job_name: 'blackbox'
    metrics_path
: /probe
    params:
      module: [http_2xx]  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - https:/
/example.com
    relabel_configs
:
     
- source_labels: [__address__]
        target_label
: __param_target
     
- source_labels: [__param_target]
        target_label
: instance
     
- target_label: __address__
        replacement
: blackbox-exporter:9115  # The blackbox exporter's real hostname:port.


There is no example in the blackbox-exporter project how to configure other modules other than http_2xx. Also, although I understand golang quite well, I don't understand where that _2xx suffix comes from.

Brian Brazil

unread,
Jul 26, 2018, 4:01:57 AM7/26/18
to IWWE, Prometheus Users
On 26 July 2018 at 08:48, IWWE <iwit...@webware-experts.de> wrote:
Hello,

I'm having trouble understanding how to configure tcp probes to service ports other than http servers.

Can someone give me an example how to probe a ssh-port?

 

I already successfully configured prom to probe http servers via blackbox-exporter:

  - job_name: 'blackbox'
    metrics_path
: /probe
    params:
      module: [http_2xx]  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - https:/
/example.com
    relabel_configs
:
     
- source_labels: [__address__]
        target_label
: __param_target
     
- source_labels: [__param_target]
        target_label
: instance
     
- target_label: __address__
        replacement
: blackbox-exporter:9115  # The blackbox exporter's real hostname:port.


There is no example in the blackbox-exporter project how to configure other modules other than http_2xx. Also, although I understand golang quite well, I don't understand where that _2xx suffix comes from.

http_2xx is an opaque string, it's the name of a module configured in the blackbox exporter's config file.

--

IWWE

unread,
Jul 26, 2018, 9:38:01 AM7/26/18
to Prometheus Users
Thanks Brian, I think I understand it a little bit more now.
Message has been deleted

jonny...@gmail.com

unread,
Jul 27, 2018, 8:35:44 AM7/27/18
to Prometheus Users
I'm having a trouble with Prometheus and blackbox-exporter integration. That's my situation: I have a blackbox-exporter deployed in an AWS cluster [service name: blackbox; namespace: kube-system] and also a Prometheus [service name: prometheus; namespace: kube-system]. I've configured Prometheus very much like you:

- job_name: blackbox-endpoints
      params:
        module:
        - http_2xx
      scrape_interval: 1m
      scrape_timeout: 10s
      metrics_path: /probe
      scheme: http
      file_sd_configs:
      - files:
        - /etc/blackbox-endpoints/*.yml
        refresh_interval: 1m
      relabel_configs:
        - source_labels: [__address__]
          target_label: __param_target
        - source_labels: [__param_target]
          target_label: instance
        - target_label: __address__
          replacement: blackbox.kube-system:9115

But when and ran my Prometheus it doesn't show the blackbox-endpoints job. Is it necessary any other configuration to do it works?

IWWE

unread,
Jul 27, 2018, 8:42:36 AM7/27/18
to Prometheus Users

First, check if prometheus sucesfully loaded the configuration file then check if the exporter blackbox.kube-system is reachable on port 9155 from your prometheus instance.
Does the exporter show up in your prometheues targets?

Jonnys Gomes

unread,
Jul 27, 2018, 8:55:03 AM7/27/18
to iwit...@webware-experts.de, promethe...@googlegroups.com
First, check if prometheus sucesfully loaded the configuration file then check if the exporter blackbox.kube-system is reachable on port 9155 from your prometheus instance.
Yes, the configuration file is loaded. I'm able to see it on Prometheus UI > Status > Configuration. And also, the blackbox is running and reachable on 9115. I'm able to enter into Prometheus Pod and do ' wget blackbox.kube-system:9115 with success.

Does the exporter show up in your prometheues targets?
No, and that's the problem. I do not understand why.

--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/Je5BfIHc1ZI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/cb6af363-1ad5-4256-8a7e-e15b01c5f051%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Atenciosamente,

Jonnys Gomes.

jonny...@gmail.com

unread,
Jul 27, 2018, 8:56:11 AM7/27/18
to Prometheus Users
First, check if prometheus sucesfully loaded the configuration file then check if the exporter blackbox.kube-system is reachable on port 9155 from your prometheus instance.
Yes, the configuration file is loaded. I'm able to see it on Prometheus UI > Status > Configuration. And also, the blackbox is running and reachable on 9115. I'm able to enter into Prometheus Pod and do ' wget blackbox.kube-system:9115 ' with success.
Does the exporter show up in your prometheues targets?
No, and that's the problem. I do not understand why.

IWWE

unread,
Jul 27, 2018, 9:09:54 AM7/27/18
to Prometheus Users
The target not showing up seems strange. Could be something with the kube system.
Sorry, I don't have any more ideas.

jonny...@gmail.com

unread,
Jul 27, 2018, 10:14:28 AM7/27/18
to Prometheus Users
It worked for me using the configuration for Blackbox Exporter in this link. Thanks anyway.
Reply all
Reply to author
Forward
0 new messages