Add Blackbox exporter as external service?

I am trying to set up Blackbox Exporter for PMM, but adding it as an external service unfortunately fails:

pmm-admin add external \
               --metrics-path='probe?' \
               --service-name="gen-test-1-blackbox_icmp.google_com" \
               --listen-port=42003 \
               --custom-labels=blackbox_target='',blackbox_module='icmp' \
               --scheme=http \

This returns
Connection check failed: Unexpected exporter's response format: text format parsing error in line 1: invalid metric name.
Running pmm-admin with --debug shows this output (besides some other stuff):


DEBUG 2023-04-14 16:12:49.554852369Z: HTTP/1.1 400 Bad Request
Content-Length: 292
Connection: keep-alive
Content-Type: application/json
Date: Fri, 14 Apr 2023 16:12:49 GMT
Server: nginx
Strict-Transport-Security: max-age=63072000; includeSubdomains;

  "error":  "Connection check failed: Unexpected exporter's response format: text format parsing error in line 1: invalid metric name.",
  "code":  9,
  "message":  "Connection check failed: Unexpected exporter's response format: text format parsing error in line 1: invalid metric name."
DEBUG 2023-04-14 16:12:49.558287917Z: Result: <nil>
DEBUG 2023-04-14 16:12:49.558666304Z: Error: &external.AddExternalDefault{_statusCode:400, Payload:(*external.AddExternalDefaultBody)(0xc0002ba090)}
Connection check failed: Unexpected exporter's response format: text format parsing error in line 1: invalid metric name.

As blackbox exporter is definitely working (icmp module is configured, and curl ‘’ does return a valid response) I assume that either my pmm admin command is wrong or the metrics path is being sanitized and the parameters (? are removed.

This is probably not the recommended way of probing blackbox exporter anyway, so how to properly use blackbox exporter with PMM (besides creating files for the textfile collector)?


You have verified, via curl, that the exporter URL is correct? It looks like it should be:

Does that work when you curl it? Does it give a proper prometheus output?

Yes. I previously only checked with, but http://localhost:42003/probe? does work as well.

Can you show the output of your attempt using curl? PMM says the output is invalid. Show the full command you are testing and full output please.

> curl 'http://localhost:42003/probe?'
# HELP probe_dns_lookup_time_seconds Returns the time taken for probe dns lookup in seconds
# TYPE probe_dns_lookup_time_seconds gauge
probe_dns_lookup_time_seconds 0.002958326
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0.009676323
# HELP probe_icmp_duration_seconds Duration of icmp request by phase
# TYPE probe_icmp_duration_seconds gauge
probe_icmp_duration_seconds{phase="resolve"} 0.002958326
probe_icmp_duration_seconds{phase="rtt"} 0.005955353
probe_icmp_duration_seconds{phase="setup"} 0.000206063
# HELP probe_icmp_reply_hop_limit Replied packet hop limit (TTL for ipv4)
# TYPE probe_icmp_reply_hop_limit gauge
probe_icmp_reply_hop_limit 116
# HELP probe_ip_addr_hash Specifies the hash of IP address. It's useful to detect if the IP address changes.
# TYPE probe_ip_addr_hash gauge
probe_ip_addr_hash 4.015196223e+09
# HELP probe_ip_protocol Specifies whether probe ip protocol is IP4 or IP6
# TYPE probe_ip_protocol gauge
probe_ip_protocol 4
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 1

That looks good. When you add the external to PMM, try escaping the & Check the PMM logs as well to see what exactly it is trying to load.

So most certainly it is the query in metrics-path that gets escaped by go:

u.Path = "probe?"


In our current implementation metrics-path directly passes to the URL.Path :

Which then gets escaped by URI encoding rules for the Path field.

It looks like there is no way to escape it.

I have created [PMM-12043] Not possible to add external service with metrics-path that includes query - Percona JIRA

Just wanted to play around with escaping, so this saved me some time, thanks for that!

This leaves me with one question though:
Setting up an external service is sufficient in order to use blackbox exporter for a couple of probes; but for a more elaborate setup (e.g. for monitoring several dozens of IP addresses or web sites) this would not be useful. I did not find a way to add an additional scrape configuration to PMM in order to utilize the “multi-target” export pattern as described for Blackbox Exporter, which also would allow relabeling.
It seems (or seemed) to be possible by manually editing the server’s configuration (see e.g. [PMM-5812] Prometheus relabeling broken (relabel_configs unmarshal errors) - Percona JIRA), but this does not look like to be “officially supported” - or would this be the way to go?

@rapli it is supported: FAQ - Percona Monitoring and Management

But it is broken again: [PMM-11196] pmm-managed failed to update configuration - Percona JIRA

@rapli, you are right. There should be a way to have a query for the metric endpoint. It could be used for multi-target or to filter results (GitHub - prometheus/node_exporter: Exporter for machine metrics).

I would agree that, in your case, custom prom config is a way to go. I hope it will be fixed soon.