Zum Inhalt springen

Keycloak (beta)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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.

From the DumbMonit server (or its relay agent) to the device:

PortProtocolPurpose
8080TCPAPI (HTTP, default)
9000TCPHealth checks on the management port (Keycloak 25 and later)
443TCPOnly 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.

All metrics are prefixed dumbmonit_keycloak_.

MetricWhatLabels
ready, live1 while the readiness / liveness check reports UP
health_check_upeach readiness check (database…), at most 32check
admin_readable1 when the service account could read the administration API (absent without credentials)
version_infovalue 1version
uptime_seconds, memory_used_percenttime since start; JVM memory in use
realms_total, realms_disabledrealms, and disabled ones
realm_sessions, realm_offline_sessions, realm_usersactive sessions, offline sessions and users of each realm readrealm
sessions_activeactive sessions, all realms read
scrape_errorscalls 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”
  1. Run Keycloak with health checks on, with the option below. From Keycloak 25 they answer on the management port 9000.

    KC_HEALTH_ENABLED=true
  2. 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
  3. On that client’s Service accounts roles tab, assign the client roles listed below, then copy the secret from its Credentials tab.

  4. In DumbMonit, enter Keycloak’s address and the client ID and secret, or choose None (health checks only).

  • view-realm: Master-realm client role: realms and their state
  • view-users: Master-realm client role: user counts
CredentialFields
None (health checks only)Nothing is sent; the health checks are public.
Client ID / secretThe 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).