Monitoring: Can I somehow filter by caddy snippet/domain?

So I have setup monitoring of caddy and asked one related question already about this:

I tried this dashboard in Grafana and it looks quite good, however, you can only filter by (server/Prometheus collection) Host (i.e. not caddys server) or Caddys handler:

image

However, that is hardly useful when you have multiple domains with different services configured in your Caddyfile. Can I somehow filter the data by caddy snippet/domain? When having multiple server blocks in your Caddy config, it would be. The current way provides data for all servers configured in a Caddyfile…

PS: The other dashboard here did not work for me.

The Caddyfile is an adapter that outputs JSON. Metrics have no relationship with the Caddyfile at all.

Run caddy adapt --pretty to see what your “real” config is, that Caddy uses to run.

Snippets are purely Caddyfile sugar for repeating chunks of config. They don’t exist in JSON.

Site blocks are also purely Caddyfile sugar for subroutes with a host matcher, and for wiring up TLS certificate automation (and a few other details, like access logs, etc).

For similar reasons as I explained in the other topic you opened, it won’t be possible to expose metrics by hostname, because metrics buckets cannot be reconfigured at runtime. See the discussion in this issue:

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.