Keycloak (beta)
Whether Keycloak can really log people in: readiness with the database check, version, realms (a disabled one is a locked-out population), and, with a service account, active sessions and users per realm.
Network ports to open
Section titled “Network ports to open”From the DumbMonit server (or its relay agent) to the device:
| Port | Protocol | Purpose |
|---|---|---|
| 8080 | TCP | API (HTTP, default) |
| 9000 | TCP | Health checks on the management port (Keycloak 25 and later) |
| 443 | TCP | Only with the https scheme behind a reverse proxy |
The failure worth watching: Keycloak up, database down. The login page still renders, nobody can log in, and every application behind Keycloak looks broken at once. /health/ready is where Keycloak says so; a 503 there is a measurement, not a transport error.
What it watches
Section titled “What it watches”All metrics are prefixed dumbmonit_keycloak_.
| Metric | What | Labels |
|---|---|---|
ready, live | 1 while the readiness / liveness check reports UP | |
health_check_up | each readiness check (database…), at most 32 | check |
admin_readable | 1 when the service account could read the administration API (absent without credentials) | |
version_info | value 1 | version |
uptime_seconds, memory_used_percent | time since start; JVM memory in use | |
realms_total, realms_disabled | realms, and disabled ones | |
realm_sessions, realm_offline_sessions, realm_users | active sessions, offline sessions and users of each realm read | realm |
sessions_active | active sessions, all realms read | |
scrape_errors | calls that failed on the last probe |
The built-in rules that apply: Keycloak not ready, Keycloak realm disabled, plus Monitor unreachable.
Let DumbMonit read Keycloak’s health and realms
Section titled “Let DumbMonit read Keycloak’s health and realms”-
Run Keycloak with health checks on, with the option below. From Keycloak 25 they answer on the management port 9000.
KC_HEALTH_ENABLED=true -
Optional, for realms, sessions and users: in the master realm, create a client named as follows, with Client authentication and Service accounts roles on, and Standard flow off.
dumbmonit -
On that client’s Service accounts roles tab, assign the client roles listed below, then copy the secret from its Credentials tab.
-
In DumbMonit, enter Keycloak’s address and the client ID and secret, or choose None (health checks only).
Required permissions
Section titled “Required permissions”- view-realm: Master-realm client role: realms and their state
- view-users: Master-realm client role: user counts
Credentials
Section titled “Credentials”| Credential | Fields |
|---|---|
| None (health checks only) | Nothing is sent; the health checks are public. |
| Client ID / secret | The service-account client. DumbMonit asks for a token (client_credentials) on /realms/<realm>/protocol/openid-connect/token at each probe. |
Address: the host name Keycloak answers on (sso.lan), host:port, or a full URL (https://sso.example.com, with /auth on legacy installs). The health checks are read on the same host, on the health port. Options: protocol, port, health port (health_port, 9000; same for Keycloak 24 and earlier), health protocol (health_scheme), realm of the client (auth_realm, master), realms to read (realms), certificate check and request timeout (15 s).