HTTP checks using blackbox-exporter and prometheus

3,793 views
Skip to first unread message

manoj.pa...@mycroft.ai

unread,
Jul 24, 2017, 6:18:52 PM7/24/17
to Prometheus Users

Trying for http checks for my docker-services.

 - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx]  
    static_configs:
      - targets:
        - http://my-nginx:80    
    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  


blackbox.yml:

modules:
  http_2xx_example:
    prober: http
    timeout: 5s
    http:
      method: GET
      #protocol: "tcp4"
      preferred_ip_protocol: "ip4"
  http_post_2xx:
    prober: http
    timeout: 5s
    http:
      method: POST
      headers:
        Content-Type: application/json
      body: '{}'
  tcp_connect:
    prober: tcp
    timeout: 5s
  icmp:
    prober: icmp
    timeout: 5s


PFA image for reference.

Can someone help me on this please ?



Thanks in advance.



Brian Brazil

unread,
Jul 25, 2017, 3:21:02 AM7/25/17
to manoj.pa...@mycroft.ai, Prometheus Users
On 24 July 2017 at 23:18, mxp7...@ucmo.edu <manoj.pa...@mycroft.ai> wrote:

That looks like a networking issue. Are you sure the blackbox exporter is running at 127.0.0.1:9115?

Brian

 

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/2d3947d4-5b32-4536-b3fb-e176002f76cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Manoj Palavalasa

unread,
Jul 25, 2017, 8:43:11 AM7/25/17
to Brian Brazil, Prometheus Users
Thanks for your response brain and yes blackbox exporter is running on my ----myip:9115. Please find the attached image for reference.

Note: I have declared my server-ip in hosts file.


Thanks & Regards,

Manoj Kumar
Mycroft.AI | Developer Operations Intern | 913-710-5432
1801 Main St. Suite 102, Kansas City, MO 64108
image (2).jpg

mxp7...@ucmo.edu

unread,
Jul 25, 2017, 9:26:56 PM7/25/17
to Prometheus Users, brian....@robustperception.io, manoj.pa...@mycroft.ai
Team,

My blackbox-exporter is working. but i am facing Get http://127.0.0.1:9115/probe?module=http_2xx&target=http%3A%2F%2Fmy-nginx%3A8080: dial tcp 127.0.0.1:9115: getsockopt: connection refused.

This is my blackbox-exporter : docker run -it -d --name blackbox-exporter --network monitor-net -p 9115:9115 -v /root/dockprom/blackbox-exporter/config/:/config dimzrio/blackbox-exporter -config.file=/config/blackbox.yml

My config file is in /root/dockprom/blackbox-exporter/config/blackbox.yml

blackbox.yml:

modules:
  http_2xx_example:
    prober: http
    timeout: 5s
    http:
      method: GET
      #protocol: "tcp4"
      preferred_ip_protocol: "ip4"
  http_post_2xx:
    prober: http
    timeout: 5s
    http:
      method: POST
      headers:
        Content-Type: application/json
      body: '{}'
  tcp_connect:
    prober: tcp
    timeout: 5s
  icmp:
    prober: icmp
    timeout: 5s



Prometheus.yml is in dockprom/prometheus/prometheus.yml

Prometheus.yml

- job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx]  
    static_configs:
      - targets:
        - http://my-nginx:80    
    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  



Any one faced with this issue ?

Thanks,
Manoj P.


To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.



--

Kallen Ding

unread,
Sep 14, 2017, 4:06:53 AM9/14/17
to Prometheus Users
That's beacuse you have booted `block_exporter` in a docker container, so the replacement you writer should be the docker host IP and port.



在 2017年7月25日星期二 UTC+8上午6:18:52,mxp7...@ucmo.edu写道:
Reply all
Reply to author
Forward
0 new messages