Grafana to monitor blackbox_exporter installed in different hosts

Hi !

I installed blackbox_exporter in two different hosts… Both are exporting data to prometheus and are correctly installed and working, since I can see accessing 9915 port.

Now, I would like to select which host I would like to see blackbox_exporter data, using a grafana dashboard. My first doubt is, how to configure prometheus yml file, since I have two blackbox_exporters… Should I config 2 jobs, like the one below? Or I can in yml file map two different sources, like: replacement: [myaddress_1.com:9115, replacement: myaddress_2.com:9115]

  • job_name: “pingtime”
    metrics_path: /probe
    params:
    module: [icmp_ipv4]
    scrape_interval: 30s
    static_configs:
    - targets:
    - mytarget.com
    relabel_configs:
    - source_labels: [address]
    target_label: __param_target
    - source_labels: [__param_target]
    target_label: instance
    - target_label: address
    replacement: myaddress_1.com:9115

And so, after that how should I set grafana dashboard variables to allow me to select from which source I will get blackbox_exporter data.

Thank you !!

Hi,

As for the variable setup, you can have a look at this example :

https://play.grafana.org/d/27c0IFkGk/data-link-with-dashboard-variable?orgId=1&var-variable=test

Here Is an example of one of my configurations :

  • job_name: ‘jvm’
    static_configs:
    • targets: [‘169.61.57.205:8080’]
      labels:
      hostname: was01
      cellname: refcell
      servername: was1server1
    • targets: [‘169.61.57.205:8081’]
      labels:
      hostname: was01
      cellname: intcell
      servername: was1server2

So here I map 3 different variable in my dashboard and filter on those.

Hope it helps, Good Luck