Caddy

INFO

This feature is available starting from simob version 0.8.3

Monitor HTTP requests, errors, traffic, and resource usage from your local Caddy server. The agent probes the Caddy admin API to collect real-time performance data, helping you track traffic spikes and server health.

Setup

Preparing Caddy for monitoring requires ensuring the admin API is enabled and accessible to the agent.

  1. Enable the admin API: By default, Caddy enables the admin API on localhost:2019. If you have disabled it or changed the port, ensure it is active.
  2. Global options: You can explicitly enable metrics in your Caddyfile using global options:
    {
        admin 127.0.0.1:2019
    }
  3. Restart Caddy: Apply any configuration changes by restarting or reloading Caddy.
  4. Restart the agent: Restart simob to trigger service discovery: sudo systemctl restart simob.

Configuration

The agent automatically discovers Caddy metrics if they are exposed on the default http://localhost:2019/metrics endpoint. No additional configuration is required.

Metrics

The following metrics are collected from the Caddy admin API:

MetricTypeUnitDescription
caddy_http_requests_totalGaugereqsTotal number of HTTP requests processed.
caddy_http_requests_rateGaugereqs/sRate of HTTP requests per second.
caddy_http_errors_totalGaugeerrsTotal number of HTTP errors (4xx and 5xx).
caddy_http_errors_rateGaugeerrs/sRate of HTTP errors per second.
caddy_http_response_bytesGaugebytesTotal bytes sent in HTTP responses.
caddy_http_response_bpsGaugeB/sThroughput of response data in bytes per second.
caddy_http_request_duration_msGaugemsTotal time spent processing requests.

Troubleshooting

Verify the endpoint

Test locally using curl to ensure Caddy is correctly exposing statistics:

curl http://localhost:2019/metrics

Discovery check

If Caddy metrics are not appearing, verify that the admin API is bound to 127.0.0.1 and that the agent has permission to access it.