Open-source website monitoring: Zabbix, Grafana, Uptime Kuma and Gatus

How to monitor websites with open-source tools: Zabbix web scenarios, Prometheus and Grafana with the blackbox exporter, Uptime Kuma and Gatus, with config examples and the catch every self-hosted monitor shares.

· 5 min read · By the Spot Downtime team

Open-source website monitoring tools cost nothing to license and keep your data on your own servers. They range from a single container with a web interface to a full metrics stack you probably already run for your servers. Here's how website monitoring works in the main ones, with enough config to get started.

The options

ToolSet up withBest for
ZabbixWeb scenarios in the Zabbix UITeams already monitoring servers and network gear with Zabbix
Prometheus + GrafanaThe blackbox exporter, PromQL alerts, Grafana dashboardsTeams with a Prometheus stack who want website checks next to their metrics
Uptime KumaA web interfaceHomelabs and small teams wanting a friendly self-hosted dashboard
GatusA YAML fileConfig-as-code, kept in git alongside the services it checks

Zabbix website monitoring

Zabbix checks websites with web scenarios, set up on a host's Web tab. A scenario is a list of steps, each a URL with the status codes it must return and a string the page must contain. Steps run in order and can carry cookies and variables from one to the next, so a scenario can log in and then load a dashboard.

Each scenario creates items you can alert on. web.test.fail[Scenario] is 0 when every step passed, or the number of the step that failed, so the usual trigger is:

last(/web-host/web.test.fail[Homepage])<>0

web.test.rspcode and web.test.time give each step's status code and response time, for graphs or a slowness trigger. The checks run from the Zabbix server or a proxy, so you see the site from one place unless you deploy proxies in other regions.

Grafana website monitoring with Prometheus

Grafana draws dashboards; it doesn't check websites itself. The usual open-source setup is Prometheus's blackbox exporter, which probes URLs when Prometheus asks, with Grafana on top for the website monitoring dashboard. Point Prometheus at the exporter like this:

scrape_configs:
  - job_name: websites
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets: [https://example.com, https://example.com/login]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox-exporter:9115

Then alert on the metrics it returns:

groups:
  - name: websites
    rules:
      - alert: WebsiteDown
        expr: probe_success == 0
        for: 2m
      - alert: CertificateExpiresSoon
        expr: probe_ssl_earliest_cert_expiry - time() < 14 * 86400

For the Grafana dashboard, the useful panels are probe_success as an up/down timeline, probe_duration_seconds for response time, probe_http_status_code, and days until probe_ssl_earliest_cert_expiry. Community dashboards for the blackbox exporter are a quick start. To check that a page contains some text, add fail_if_body_not_matches_regexp to the module in the exporter's config.

Uptime Kuma

Uptime Kuma is the friendliest of the four: one Docker container, a clean web interface, HTTP, keyword, TCP, ping and DNS checks, many notification services and simple status pages. It's a single-instance app, so it checks from one place, and it's run by whoever runs the server. Our Uptime Kuma alternatives post compares it with hosted options.

Gatus

Gatus suits teams that want monitoring as code: every endpoint and its conditions live in a YAML file you review like any other change.

endpoints:
  - name: home
    url: https://example.com
    interval: 1m
    conditions:
      - "[STATUS] == 200"
      - "[RESPONSE_TIME] < 1000"

It serves a status page of its own, and sends alerts to Slack, PagerDuty, email and others.

The catch with every self-hosted monitor

A monitor running on your own infrastructure fails in the ways it's meant to watch for. If the server, network or data centre goes down, it takes the monitor with it, and nobody gets an alert. Three habits help:

  • Run it somewhere else. A small server with a different provider from the sites it watches.
  • Monitor the monitor. Have it ping an external heartbeat. If the pings stop, the outside service alerts you.
  • Remember it's one location. A check from one place can't tell “the site is down” from “the route from here is broken”, so expect some false alarms or add a second location.
The self-hosted monitor can't report its own outage; a heartbeat outside it can.

A dead man's switch for Prometheus

Prometheus setups often include a Watchdog alert that always fires. Route it to a Spot Downtime heartbeat with Alertmanager's webhook receiver and a short repeat_interval. As long as Prometheus and Alertmanager are working, the heartbeat keeps getting pinged; when they stop, you get an alert from outside.

route:
  routes:
    - matchers: [alertname = "Watchdog"]
      receiver: heartbeat
      repeat_interval: 5m
receivers:
  - name: heartbeat
    webhook_configs:
      - url: https://YOUR-HEARTBEAT-URL

Free, but not free of work

Self-hosting trades a subscription for upgrades, backups, a server bill and being the person who fixes it. That's a good deal if you run servers anyway. If you don't, a hosted free plan is usually less work: Spot Downtime's covers 20 monitors checked from three regions, and public open-source projects can apply for the free Open Source plan.

Get new guides by email

Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.

Unsubscribe from any email with one click. See our privacy policy.

Keep reading