Monitor the same url with different header using blackbox

719 views
Skip to first unread message

huihui...@gmail.com

unread,
Jun 14, 2017, 10:54:07 PM6/14/17
to Prometheus Users
I used blackbox to monitor some of the url, the URL of the address is the same, but the header is not the same. My approach is to add a job in prometheus.yml each time, and add a module  in the blackbox.yml, as shown below:


But the problem is that in prometheus.yml will add a lot of similar jobs, the same will be in blackbox.yml increase particularly similar to the module, is there any better way to solve this problem?
Thanks!

Brian Brazil

unread,
Jun 15, 2017, 3:11:51 AM6/15/17
to huihui...@gmail.com, Prometheus Users
That's the general way to solve it.

--

Ben Kochie

unread,
Jun 15, 2017, 4:10:41 AM6/15/17
to Brian Brazil, huihui...@gmail.com, Prometheus Users
You can also do a bit of rewrite rule trickery to embed the env into the target name.

scrape_configs:
  - job_name: 'blackbox'
    metrics_path: /probe
    static_configs:
      - targets:
        - target:4332|env1
        - target:4332|env2
        - target:4332|env3
    relabel_configs:
      - source_labels: [__address__]
        regex: (.+)\|.*
        target_label: __param_target
      - source_labels: [__address__]
        regex: .+\|(.*)
        replacement: http_2xx_with_${1}
        target_label: __param_module
      - source_labels: [__address__]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115  # Blackbox exporter.

--
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/CAHJKeLrY4%3DngiUwH%3D2cZ-GEBv5L0A9vS-gZ%2BS5sgbdy7QQa-Fw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages