Search code examples
prometheusgrafanaprometheus-blackbox-exporter

Would it be possible to remove or hide values from Grafana dashboard when data coming from blackbox_exporter has probe_success = 0?


I am trying to monitor some IP addresses locally with blackbox_exporter through Prometheus and Grafana for visualization.

I am able to gather the data I need with ICMP pings but if they fail I get the timeout time as ping duration (as per design) instead of null (or empty).

I did verify that in the event of an unsuccessful ping the reported value in ms is 9.5s (with 10s being the timeout limit):

Example graph

The queries used for this are as follows:

probe_duration_seconds{instance=~"$target"}
probe_success{instance=~"$target"}

I am looking around query operations and the data transformation tab but wasn't able to figure it out yet.


Solution

  • You can simply use this query:

    probe_duration_seconds{instance=~"$target"} and probe_success{instance=~"$target"} == 1
    

    It will return probe_duration_seconds only if probe_success with corresponding set of labels had value 1.

    More on how logical binary operators work you can read in official documentation.