用 DumbMonit 监控 Caddy
The web server and reverse proxy: upstreams failing their health checks, a configuration reload that failed, handler errors and the share of 5xx answers.
产品说明为英文,与产品内一致。页面标签使用您的语言。
DumbMonit 监控的内容
The web server and reverse proxy: upstreams failing their health checks, a configuration reload that failed, handler errors and the share of 5xx answers.
典型用途. Web server and reverse proxy: upstream health, failed reloads, handler errors, 5xx share
示例
- Caddy in Docker
- Caddy as a reverse proxy
- Caddy on a Linux host
连接方式
您需要准备
- Read-only viewThe user of the basic_auth block of the read-only view (recommended).
无需账户。
需要开放的网络端口
2019/TCPAdmin API (HTTP, default)
设置步骤: Publish a read-only view of Caddy's admin API
Hash a password for the user dumbmonit.
caddy hash-password --plaintext 'a-long-password'Add this site to the Caddyfile, put the hash in place of HASH, then reload Caddy.
:2020 { basic_auth { dumbmonit HASH } @readonly { method GET path /config/apps/http/servers /reverse_proxy/upstreams /metrics } handle @readonly { reverse_proxy localhost:2019 { header_up Host localhost:2019 } } respond 403 }Optional: add metrics to the global options block at the top of the Caddyfile to count requests and errors.
metricsFilter port 2020 so that only the DumbMonit host reaches it.
In DumbMonit, enter the Caddy host with that port, for example caddy.lan:2020, and the user dumbmonit with its password.
注意. Never expose the admin API itself: whoever reaches port 2019 can replace the configuration or stop Caddy.