A KISS monitoring service: one static binary, one YAML config file, one SQLite file.
Gjallar watches your services, shows a status page with history (black & red, HTMX-refreshed), and alerts you when something goes down — and when it recovers.
| Type | What it checks |
|---|---|
http |
HTTP/HTTPS request: status code (expect_status), body regex, a value of the JSON body (json_path + rule), TLS certificate expiry (cert_expiry_warn); follow_redirects: false judges a 3xx itself |
postgres |
SQL query result against a rule (pure-Go pgx driver) |
oracle |
SQL query result against a rule (pure-Go go-ora driver, no Oracle client needed) |
ping |
ICMP echo (privileged or unprivileged) |
tcp |
TCP connect; with tls: true a TLS handshake and the certificate expiry (LDAPS, SMTPS, IMAPS, ...) |
dns |
A name resolves (record_type: A, AAAA, CNAME, MX, NS, TXT), optionally on a given resolver, optionally matching a rule |
redis |
TCP connect + optional AUTH + PING/+PONG |
elasticsearch |
freshness: hours since max(timestamp_field) in an index, checked against a rule |
prometheus |
Fetches a /metrics route and evaluates a rule against metric values, with optional label selectors |
push |
Passive: a job pings Gjallar when it runs; the monitor fails when no ping came within max_age |
Rules: > N, >= N, < N, <= N, == x, != x, ~ regex, rows > 0 (row count).
Wherever a rule applies, an optional warn_rule (same syntax) adds an early
threshold: when rule holds but warn_rule does not, the monitor stays up
with a warning. Both are assertions of the healthy state:
- name: es-broadcasts
type: elasticsearch
url: "http://es-host:9200"
index: "broadcasts"
timestamp_field: "start_date"
rule: "< 3" # DOWN when the newest document is more than 3h old
warn_rule: "< 2" # WARNING from 2h onlatency_warn: 2s (any monitor type) raises a warning when a passing check
took longer than that.
- name: api-health
type: http
url: "https://example.com/health"
json_path: "checks.database.state" # dots walk objects, numbers index arrays
rule: "== ok"The value at json_path is read as text (numbers as written, true, false,
null) and checked against rule (and warn_rule). On an array, rows
rules test its length: json_path: "jobs.failed", rule: "rows == 0".
For anything that runs on its own schedule (a backup, a cron job, a batch): the job reports in, and Gjallar alerts when it stops doing so.
- name: nightly-backup
type: push
max_age: 26h # fail when no ping arrived for longer than this
token: "${BACKUP_PUSH_TOKEN}" # optional shared secret# at the end of the job
curl -fsS "http://gjallar:8080/api/v1/push/nightly-backup?token=$TOKEN"
# or report the outcome
curl -fsS -d status=fail -d "msg=rsync exited 23" -H "Authorization: Bearer $TOKEN" \
http://gjallar:8080/api/v1/push/nightly-backupstatus is up (default), warn or fail; msg is shown with a warning or
a failure. A monitor that has never been pinged is given max_age before it
is reported missing. The ping is evaluated at the monitor's next interval.
- Any shoutrrr URL: Telegram, email/SMTP, ntfy, Discord, Slack, Gotify, Pushover, generic webhooks, ...
- Free Mobile SMS API (
type: freemobile). - Signal via a signal-cli-rest-api
gateway (
type: signal:urlto/v2/send, sendernumber,recipients; optionaltokenfor Bearer auth oruser/passfor HTTP Basic).
A monitor alerts after failure_threshold consecutive failures (no flapping noise),
and again on recovery. Open incidents survive restarts: no duplicate alerts.
Degraded-but-up conditions raise an amber warning instead of an outage.
- Retries. A failed send is retried after 5 s, 30 s and 2 min. Each channel has its own queue: a slow or broken channel delays neither the checks nor the other channels, and its alerts stay in order.
- History. Every alert and what became of it (sent, failed after N attempts, suppressed and why) is logged and shown on the status page, on the monitor's page and in the monitor API.
- Test a channel before you need it:
gjallar -config gjallar.yaml -test-alert sms(or-test-alert all) sends a test message and exits non-zero if a channel fails. - Alerts still queued at shutdown or reload are sent before the process exits.
Per alert channel:
alerts:
sms:
type: freemobile
user: "12345678"
pass: "${FREEMOBILE_KEY}"
on: [down, up] # only outages and recoveries; warnings go elsewhere
group_wait: 30s # alerts raised within 30s leave as ONE messageon filters by event: down (DOWN and STILL DOWN reminders), up,
warning (WARNING and WARNING CLEARED). Omit it to receive everything.
group_wait holds alerts for that long and sends those that accumulated as a
single digest ([Gjallar] 12 alerts: 11 DOWN, 1 UP, one line each): when a
whole site drops, you get one SMS instead of dozens — and stay under the
provider's quota. An alert alone in its window is sent as is. Default 0:
every alert at once.
depends_on names the monitors another one sits behind — a link, a gateway,
a database:
- name: mada-link
type: ping
host: "10.9.0.1"
- name: mada-encoder
type: http
url: "http://10.9.0.20/health"
depends_on: [mada-link]While mada-link is failing, alerts about mada-encoder are held: its
incident is recorded and the status page shows it down, but you are told about
the link only. If the encoder is still down once the link is back, its DOWN
alert goes out then. A held outage that heals with its dependency stays
silent. Dependencies chain naturally (A behind B behind C), and a whole group
can declare one (see groups). Give a dependency an interval no
longer than its dependents', so its failure is seen first.
During a maintenance window the covered monitors keep being checked — history stays truthful — but raise no alert:
maintenance:
- name: "pg16 upgrade"
start: "2026-11-25 22:00" # local time, or RFC 3339
end: "2026-11-26 02:00"
groups: ["Databases"]
- name: "nightly backups"
daily: "02:00-03:30" # every day; may cross midnight
days: [sat, sun] # optional: the days the window starts on
monitors: [main-db, heartbeats]A window covers the listed monitors and groups, or everything when both
are omitted. Monitors in a window show a MAINTENANCE badge and do not count
as problems. As with dependencies, an outage still there when the window
closes is alerted then, and a recovery is announced only for an outage that
was.
By default a state change is confirmed at the pace of interval: with
interval: 60s and failure_threshold: 3, an outage is alerted after two to
three minutes. retry_interval brings the confirming checks forward:
defaults:
interval: 60s
failure_threshold: 3
retry_interval: 10s # after a first failure, re-check every 10s
recovery_threshold: 2 # and require 2 passes in a row before UPAfter a failure that has not reached failure_threshold yet, the next check
runs after retry_interval; same for a pass after a confirmed outage, until
recovery_threshold passes in a row (default 1) close the incident. A relapse
during recovery resets the count: a flapping service sends one DOWN, not a
DOWN/UP pair per flap.
By default a monitor alerts once when it goes down and once when it recovers.
Set realert: 1h (globally in defaults or per monitor) to also get a
"still down" reminder at that interval during long outages.
Some conditions are worth a heads-up but are not an outage: a TLS certificate
approaching expiry (cert_expiry_warn), partial packet loss on a ping
monitor, a warn_rule or latency_warn threshold crossed, a job reporting
status=warn. A check that passes but reports a message like that puts the
monitor in an amber WARNING state:
- The service stays up: no incident is opened and uptime figures are untouched.
- The message is shown on the card, the detail page and in the check history.
- After
failure_thresholdconsecutive warning checks, a single[Gjallar] WARNINGnotification is sent to the monitor's alert channels; a[Gjallar] WARNING CLEAREDfollows when the condition goes away. There is no periodic reminder. The state survives restarts and reloads, so a warning is never notified twice. - A real failure takes precedence: DOWN/UP alerts and incidents work as usual.
The page opens on a one-line summary of the fleet and, when something is wrong, the list of what needs attention — down first, then warnings — before the monitors themselves. Groups can be collapsed; the choice is remembered in the browser. A monitor's page shows its uptime over 24 hours, 7, 30 and 90 days, one bar per day over the last 90 days, its incidents, the alerts sent about it and its recent checks.
The page polls every 10 s. Responses are gzipped, and a poll for a page that
has not changed since the last one is answered 204 with no body.
GET /api/v1/status returns, as JSON, what the status page shows: every
monitor with its current state (up, warning, down, pending,
disabled), its last message, latency and check time, plus the incidents
that are open or were resolved recently.
curl 'http://localhost:9292/api/v1/status?since=168h&limit=200'since (a Go duration, default 168h) bounds the resolved incidents
returned, open ones are always included; limit (default 200, at most 1000)
caps the incident list. Times are RFC 3339 in UTC. A monitor inside a
maintenance window carries "maintenance": "<window name>". Like the page,
the API has no authentication: put it behind a proxy if it must not be public.
Gangradr2 polls it to show outages and warnings in its Imbox.
GET /api/v1/monitors/{name}?limit=100&days=90 returns the monitor's state,
its uptime (0..1) over 24h, 7d, 30d and 90d, its last limit
checks, one entry per day of history (checks, failures, warnings, uptime,
average and maximum latency), its incidents and the alerts sent about it.
GET /metrics exposes the fleet in the Prometheus text format, for Grafana
or an existing Prometheus: gjallar_monitor_up, gjallar_monitor_warning,
gjallar_monitor_maintenance, gjallar_monitor_enabled,
gjallar_monitor_latency_seconds,
gjallar_monitor_last_check_timestamp_seconds,
gjallar_monitor_uptime_ratio{window="24h"} (all labelled monitor,
group, type), and gjallar_incidents_open, gjallar_healthy,
gjallar_build_info.
A monitoring service that dies silently is worse than none. Three independent ways to notice:
-
/healthzanswers200 okonly while check results are flowing and being stored; otherwise503with the reason. Point a load balancer, a container health check or another monitoring tool at it. -
Heartbeat. While healthy, Gjallar requests a URL of your choice; the service behind it alerts when the pings stop — a host that lost power cannot tell you so itself. Works with healthchecks.io-style services, or with a
pushmonitor of a second Gjallar:heartbeat: url: "https://other-gjallar.example.com/api/v1/push/gjallar-prod?token=${HB_TOKEN}" interval: 60s # default
-
systemd watchdog. With
Type=notifyandWatchdogSec=in the unit (seedeploy/gjallar.service), systemd restarts Gjallar if it stops reporting healthy.
CGO_ENABLED=0 go build -trimpath -ldflags "-s -w"
cp gjallar.example.yaml gjallar.yaml # edit to taste
./gjallar -config gjallar.yaml -check # validate without running anything
./gjallar -config gjallar.yamlThen open http://localhost:8080.
Configuration reference: see gjallar.example.yaml —
every field is documented there.
Durations accept Go units (30s, 5m, 12h) and d for days: retention: 30d,
cert_expiry_warn: 14d, max_age: 1d2h.
Any config value may reference an environment variable with ${VAR} syntax:
dsn: "postgres://monitor:${PG_PASSWORD}@db1:5432/app"Startup fails with a clear error if a referenced variable is undefined. A bare
$ (e.g. in a ~ ^OPEN$ regex rule) is left untouched.
Several monitors querying the same database share one DSN:
connections:
reco: "postgres://gjallar:${RECO_PASSWORD}@10.2.70.131:5432/reco"
monitors:
- name: reco-ingest-lag
type: postgres
connection: reco # instead of dsn
query: "SELECT ..."
rule: "< 300"include: ["conf.d/*.yaml"] # relative to this file, loaded in lexical orderIncluded files add monitors, alerts, groups, connections and
maintenance windows to the main file — one file per team or per system, for
instance. The global settings (listen, database, defaults, ...) stay in
the main file. Defining the same alert, group or connection twice is an error.
Gjallar reloads its configuration on SIGHUP (systemctl reload gjallar).
The new config — included files too — is fully validated first; if it is
broken, the running configuration is kept and the error is logged.
Set enabled: false on a monitor to stop checking and alerting on it while
keeping it on the status page, shown with a grey DISABLED badge and
excluded from the group's up/total count. Omitting enabled (or true)
leaves it active.
- name: "legacy-api"
type: http
url: "http://legacy/health"
enabled: false # listed as disabled, never checkedRemoving a monitor from the config entirely (rather than disabling it) purges
its history and incidents at the next startup, so a decommissioned host stops
appearing, including any incident left open when it went away. Use
enabled: false when you want to keep the monitor and its history.
Give monitors an optional group: "Hyperion" and the status page shows them
under a common, collapsible header with an up/total count. Monitors without
a group are listed first, without a header. Groups appear in config order.
A group can also carry defaults for its members — the same keys as
defaults:. A monitor's own value wins, then its group's, then the global
default:
groups:
"Transfert Mada":
interval: 5m
failure_threshold: 2
alerts: [signal] # no SMS for this group
depends_on: [mada-link] # every member sits behind the link(mada-link may itself be a member of the group: it does not depend on
itself.)
log_level: info # debug | info | warn | error
log_format: text # text | jsonAt the default level the log records what changes: a check starting to fail
(WARN), passing again (INFO), a warning appearing, alerts sent, held or
failed. Checks that merely confirm the known state are logged at debug.
Both settings are re-read on reload.
Unprivileged ping (privileged: false, the default) needs:
sudo sysctl -w net.ipv4.ping_group_range="0 2147483647"Privileged ping (privileged: true) needs raw sockets:
sudo setcap cap_net_raw+ep ./gjallaror the systemd unit's AmbientCapabilities=CAP_NET_RAW (see
deploy/gjallar.service). Gjallar self-tests ping at
startup and exits with the fix if permissions are missing.
Everything lives in a single SQLite file (database). Back up by copying it.
retention(default30d): raw check results and the alert log.stats_retention(default90d, never shorter thanretention): hourly aggregates of the checks — what the uptime figures and the 90-day history are computed from — and resolved incidents.
Both are pruned hourly. The schema is versioned and upgraded in place on startup; a database from an earlier release gets its hourly aggregates rebuilt from the results it holds. That happens once and delays that first start: about 20 s for 5 million stored results.
go test ./...Database integration tests are skipped unless pointed at a server:
docker run --rm -e POSTGRES_PASSWORD=secret -p 5432:5432 postgres:16
GJALLAR_TEST_PG_DSN="postgres://postgres:secret@localhost:5432/postgres?sslmode=disable" go test ./internal/check/
docker run --rm -p 1521:1521 -e ORACLE_PASSWORD=secret gvenzl/oracle-free:23-slim
GJALLAR_TEST_ORA_DSN="oracle://system:secret@localhost:1521/FREEPDB1" go test ./internal/check/- One goroutine per monitor → one results channel → one consumer (lock-free alert state machine) → one queue per alert channel.
- One SQLite connection: writers are serialized by
database/sql. - Everything embedded: templates, htmx, CSS, logo. No CDN, no CGO, no ORM, no router dependency.
