Skip to content

Your First Endpoint

By the end of this chapter one real service is being watched: Gatus visits it every ten seconds, the log shows each visit's verdict, and the API hands you the same verdicts as data. The lab's service is a tiny web server written for this guide — it lives in gatus-lab/serve.py, it needs nothing but Python 3, and it serves two things on this machine only: a page at http://127.0.0.1:8734/ and a health reply at http://127.0.0.1:8734/health. Anything you already run — a web server, a router's page, your own app — can stand in for it; the steps are the same.

Start something worth watching

python3 gatus-lab/serve.py

(Started in the background in the lab, so the terminal stays free.) Prove it is up before asking Gatus to judge it — always separate "the service is broken" from "the watcher is broken" while you still can:

curl -s http://127.0.0.1:8734/health
{"status": "UP", "version": "1.0"}

Write the endpoint down

Add the endpoint to the config from chapter 3 (the lab's full config is gatus-lab/config.yaml):

endpoints:
  - name: health-api
    group: lab
    url: "http://127.0.0.1:8734/health"
    interval: 10s
    conditions:
      - "[STATUS] == 200"
      - "[BODY].status == UP"

Four decisions are in those lines. The name is yours — short and plain, it will label rows and badges. The group gathers related endpoints on the dashboard (the lab puts everything in lab). The interval is the visiting schedule: 10 seconds is a teaching pace, quick enough to watch things change; 60 seconds is Gatus's default and a saner pace for real services. And the conditions say what healthy means — here, a 200 status and a body whose status field reads UP. The second condition is the one that matters in real life: plenty of broken services answer 200 with bad news in the body. Chapter 5 is devoted to conditions.

Watch it work

Start Gatus (or leave it running — it reloads a changed config by itself, usually within seconds; the lab's transcript t07-config-reload.txt shows the log line and the new condition taking effect with no restart). Within seconds the log gains a line per visit:

[watchdog.executeEndpoint] Monitored group=lab; endpoint=health-api; key=lab_health-api; success=true; errors=0; duration=9ms

Read it left to right: who was visited (group and endpoint), the key Gatus files the result under (lab_health-api — group, underscore, name; badges and API addresses use it), the verdict (success=true), how many problems the visit met (errors=0), and how long it took. Ten seconds later there is another. That rhythm — visit, verdict, line — is the whole machine running.

The dashboard shows the same facts as a page: open http://127.0.0.1:8085 and find health-api in the lab group, green, its strip of recent results filling in one block per visit.

The check: read the verdict as data

The log and the page are for humans. The API is the same truth for programs, and it is this chapter's check:

curl -s http://127.0.0.1:8085/api/v1/endpoints/lab_health-api/statuses

Each result in the reply carries its timestamp, the measured duration, and — the part to learn to read — the condition-by-condition account:

{
  "status": 200,
  "duration": 2464282,
  "conditionResults": [
    { "condition": "[STATUS] == 200", "success": true },
    { "condition": "[BODY].status == UP", "success": true }
  ],
  "success": true,
  "timestamp": "2026-10-29T18:24:41.020488367Z"
}

(Real lab output, trimmed; the full reply is gatus-lab/api-statuses.json, and transcript t03-api-statuses.txt summarises all three of the lab's endpoints.) Two details: duration is in nanoseconds — the log's 9ms is the human version of the same number. And success at the bottom is simply "did every condition pass" — one false anywhere in the list makes the visit a failure, whatever the status code said.

Now break it, gently

Point a second endpoint at a port where nothing listens — the lab uses 8799 — with the same shape of config, and watch the other kind of verdict arrive:

Monitored group=lab; endpoint=gone-service; key=lab_gone-service; success=false; errors=1; duration=1ms

In the API, its latest result explains itself, in the error text and in the conditions with their resolved values shown in place:

"errors": ["Get \"http://127.0.0.1:8799/\": dial tcp 127.0.0.1:8799: connect: connection refused"]
"[CONNECTED] (false) == true"  -> false
"[STATUS] (0) == 200"           -> false

No connection, no status, no success — and a specific reason, not a bare red light. You now have both halves of the craft: a watcher that says up and can prove it, and one that says down and can explain it. What remains is making the rules sharper (chapter 5), making the failures reach a human (chapter 6), and reading the whole board at a glance (chapter 7).