DumbMonit

监控项

Web 服务器与反向代理

Traefik、Caddy、Nginx、Apache 和 Nginx Proxy Manager:后端、证书和错误率。

监控项描述和告警规则文本为英文,与产品一致。页面标签使用您的语言。

Traefik

traefik

The reverse proxy: routers disabled by a configuration error, backend servers failing their health check, certificates that never arrive or are not renewed, and the share of 5xx answers.

示例

  • Traefik in Docker
  • Traefik on Kubernetes
  • Traefik in front of self-hosted apps

您需要准备

  • basicAuth userThe user of the basicAuth middleware in front of the API and the metrics.

无需账户。

默认端口: 8080

内置告警规则 7

  • 提示Traefik router disabledA router is disabled by a configuration error (missing service or middleware, invalid rule): its sites are not served.
  • 提示Traefik backend server downA server of a load-balanced service fails its health check.
  • 警告Traefik service without a serverNo server of a service answers its health check: its sites get 503.
  • 提示Traefik certificate not obtainedRouters ask a certificate resolver for a certificate that no certificate held by Traefik covers yet: Traefik serves its default self-signed certificate.
  • 提示Proxy certificate not renewedA certificate Traefik holds or a Nginx Proxy Manager host presents expires in less than 14 days: automatic renewal starts at 30, so it is failing.
  • 提示Reverse proxy answering 5xxMore than 5 % of the answers over ten minutes were 5xx, with at least fifty requests. Needs the proxy's metrics.
再显示 1 条
  • 警告Monitor unreachableNo measurement received for more than three minutes. bottomk by (target) (1, time() - tlast_over_time(dumbmonit_up[7d]))
设置步骤: Let DumbMonit read Traefik's API
  1. Add these arguments to Traefik's command (or the same keys to its static configuration), then restart it.

    --api.insecure=true
    --metrics.prometheus=true
  2. Open http://traefik.lan:8080/api/overview from the DumbMonit host: it must answer with JSON.

  3. Optional: protect /api and /metrics with a basicAuth middleware on an entry point of your own, and create the user with htpasswd.

    htpasswd -nbB dumbmonit 'a-long-password'
  4. In DumbMonit, enter the Traefik host, for example traefik.lan, with the port of that entry point if it is not 8080.

注意. Port 8080 answers without a password: filter it so that only the DumbMonit host reaches it.

文档

Caddy

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.

示例

  • 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

内置告警规则 4

  • 提示Caddy upstream unhealthyA backend fails Caddy's active or passive health check.
  • 提示Caddy configuration reload failedCaddy refused its last configuration reload and still runs the previous one.
  • 提示Reverse proxy answering 5xxMore than 5 % of the answers over ten minutes were 5xx, with at least fifty requests. Needs the proxy's metrics.
  • 警告Monitor unreachableNo measurement received for more than three minutes. bottomk by (target) (1, time() - tlast_over_time(dumbmonit_up[7d]))
设置步骤: Publish a read-only view of Caddy's admin API
  1. Hash a password for the user dumbmonit.

    caddy hash-password --plaintext 'a-long-password'
  2. 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
    }
  3. Optional: add metrics to the global options block at the top of the Caddyfile to count requests and errors.

    metrics
  4. Filter port 2020 so that only the DumbMonit host reaches it.

  5. 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.

文档

Nginx

nginx

The web server and reverse proxy: active and waiting connections, the accept/handled/request rates, and upstream health when the commercial NGINX Plus API is available.

示例

  • Nginx in Docker
  • Nginx as a reverse proxy
  • Nginx on a Linux host

您需要准备

  • Basic authIf the status page sits behind a basic auth block or directive.

无需账户。

默认端口: 80

内置告警规则 1

  • 警告Monitor unreachableNo measurement received for more than three minutes. bottomk by (target) (1, time() - tlast_over_time(dumbmonit_up[7d]))
设置步骤: Enable Nginx's stub_status module
  1. Add this location to the server block Nginx already serves, restricted to the DumbMonit host (adjust the address).

    location /basic_status {
    stub_status;
    allow 10.0.0.5;
    deny all;
    }
  2. Reload Nginx.

    nginx -s reload
  3. Open http://nginx.lan/basic_status from the DumbMonit host: it must show Active connections.

  4. In DumbMonit, enter the Nginx host, for example nginx.lan, and the path if it is not /basic_status.

  5. If NGINX Plus is installed, tick Read the NGINX Plus API to add upstream health and per-zone counters.

注意. stub_status only counts connections and requests: a configuration error in a server block or an unreachable backend does not show there.

文档

Apache httpd

apache

The web server: busy and idle workers, the worker scoreboard by state, and request/byte rates when ExtendedStatus is on.

示例

  • Apache in Docker
  • Apache on a Linux host
  • A LAMP stack

您需要准备

  • Basic authIf the status page sits behind a basic auth block or directive.

无需账户。

默认端口: 80

内置告警规则 1

  • 警告Monitor unreachableNo measurement received for more than three minutes. bottomk by (target) (1, time() - tlast_over_time(dumbmonit_up[7d]))
设置步骤: Enable Apache's mod_status
  1. Enable mod_status (it ships with Apache and is usually on already).

    a2enmod status
  2. Add this location to the Apache configuration, restricted to the DumbMonit host (adjust the address).

    <Location "/server-status">
    SetHandler server-status
    Require ip 10.0.0.5
    </Location>
  3. Optional: turn on the request and byte counters.

    ExtendedStatus On
  4. Reload Apache, then open http://apache.lan/server-status?auto from the DumbMonit host.

    apachectl graceful
  5. In DumbMonit, enter the Apache host, for example apache.lan, and the path if it is not /server-status.

注意. Without ExtendedStatus, requests and bytes are not reported at all: the chart stays empty rather than flat.

文档

Nginx Proxy Manager

npm

The proxy manager: hosts nginx refused to load, disabled hosts, and the certificates the hosts present, before Let's Encrypt renewal failures turn into expired sites.

示例

  • Nginx Proxy Manager in Docker
  • NPM in front of self-hosted apps

您需要准备

  • User email and passwordA user of its own, allowed to view the hosts and nothing else.

默认端口: 81

内置告警规则 3

  • 提示Nginx Proxy Manager host offlinenginx refused an enabled host's configuration: the host is not served.
  • 提示Proxy certificate not renewedA certificate Traefik holds or a Nginx Proxy Manager host presents expires in less than 14 days: automatic renewal starts at 30, so it is failing.
  • 警告Monitor unreachableNo measurement received for more than three minutes. bottomk by (target) (1, time() - tlast_over_time(dumbmonit_up[7d]))
设置步骤: Create a view-only Nginx Proxy Manager user
  1. In Nginx Proxy Manager, open Users → Add User, give it an email of its own such as dumbmonit@example.com, and leave every role unticked.

  2. From that user's menu, open Permissions and set the levels listed below.

  3. From the same menu, choose Change Password and set a password.

  4. In DumbMonit, enter the Nginx Proxy Manager host with its web port, for example npm.lan:81, and that email and password.

注意. Leave SSL Certificates on Hidden: Nginx Proxy Manager hands private keys to any user allowed to view them.

文档