I want to share with you a solution for monitoring your Caddy server with Grafana.
I decided to write this because it is not easy to find the necessary information on this subject and it is difficult to find an example of a recent Grafana Dashboard.
To do this, I used the following tools:
Grafana which is a data analysis and monitoring tool.
Prometheus which communicates with the REST API of the Caddy web server.
Loki (Promtail) which retrieves json logs from the Caddy web server.
Thank you so much! this works really well for my homelab
just one comment for anybody who will do this on their large docker-compose. Slight offtopic, but related to caddy admin, and may be helpful for people who will try to setup this.
in case, if you a lot of networks, and do not want (you probably now want) to expose caddy admin to another containers, you could use network alias and bind caddy admin to that alias. Itβs same thing as binding to specific interface, but just will use alias, as in docker networks itβs not a good thing to bind to static ipβs
In example below, network caddy_with_admin is used to bind caddy admin. Only within this network, caddy container is aliased to caddy-aliased. In other_network, itβs not resolvable. To access caddy admin from another container, just add it to caddy_with_admin net and try to curl caddy-aliased:2019, it will work