Can't get Prometheus Blackbox Exporter TCP to show probe status


I have a weird problem. I’ve set up Blackbox probes for both HTTP and TCP targets, and they all show as “UP” in the Prometheus interface (see 2 examples below):

However, when I try to add them to Grafana, the HTTP probes show “UP”, but the TCP probes show “DOWN”.

My setups for those are in the first post.

Can anybody explain what’s wrong with the setup for the TCP target, since it shows “DOWN” in Grafana and not “UP” (like it does in the Prometheus interface)?

Thanks a lot!

Images of my Grafana setup for those 2 probes:

Use Grafana Query Inspector on each query to see exactly what data Grafana is getting from Prometheus - e.g. either a 0 or 1.

That will at least tell you if the cause of the problem is Grafana or Prometheus.

Or sometimes using Query Inspector you can see that Grafana is actually getting more than one value if there is a mis-configuration somewhere. In those cases the visualisation may not be showing the value you expect.

Thanks. I can also see when I run the query inside Prometheus, that I get a return value of 0, so the problem is clearly that Prometheus is getting a value of 0 instead of 1. I guess I need to fiddle with the configuration of the Prometheus Blackbox module to get it to return a value of 1 for a simple TCP probe.

However, is there any way that you in Grafana can convert a value of “0” to “1”, and a “no value” to “0”?

This was a problem with the prometheus.yml file. I had prefixed the tcp targets with http://, which is of course wrong. Lesson learned. :wink: