The Keycloak plugins query the Keycloak Admin REST API (/admin/serverinfo)
against the master realm. Tested with Keycloak 18 and later.
keycloak-memory-usage: JVM heap usage of the Keycloak server.keycloak-stats: realm, client, user and active-session counts.keycloak-version: installed Keycloak version, with an EOL check against the Keycloak release schedule.
All three plugins need a Keycloak user in the master realm with read access
to the Admin REST API. Reading /admin/serverinfo is a privileged operation,
so the user needs exactly one of the following minimal roles:
- Client role
query-groupsof themaster-realmclient (recommended, least privilege). In the role-mapping dialog, switch the filter from Realm roles to Client roles and pick themaster-realmclient to see it. - Realm role
create-realmon themasterrealm (fallback if the client-role option is not available in your workflow).
Any role of the master-realm client other than impersonation works too;
pick the narrowest one you are comfortable with.
Setup in the Admin Console (Keycloak 19 and later):
- Users > Add user, set Username to
keycloak-monitoring, leave Email verified off, Create. - Open the user, Credentials > Set password. Type the password twice, turn the "Temporary" toggle off so the password does not expire at first login, Save.
- Role mapping > Assign role. Switch the filter to the
master-realmclient and assignquery-groups. If you prefer the realm-role fallback, stay on Realm roles and assigncreate-realminstead.
The plugins are invoked with --url, --realm master (the default),
--username keycloak-monitoring and --password.
Shared across all Keycloak plugins (run <plugin> --help for the full list):
--url: Keycloak base URL. Defaulthttp://127.0.0.1:8080.--realm: realm the user authenticates against. Defaultmaster.--client-id: OIDC client used to obtain the admin token. Defaultadmin-cli.--username/--password: credentials of the monitoring user.--insecure: skip TLS certificate verification.--no-proxy: ignoreHTTP_PROXY/HTTPS_PROXY.--timeout: network timeout in seconds.
The shipped basket activates the Keycloak plugins through one Service Set,
assigned via the keycloak tag on the host:
- Keycloak Service Set: runs
keycloak-memory-usage,keycloak-statsandkeycloak-versionagainst the monitoring user above.