How do I troubleshoot setting up Grafana for ITRS Analytics?
The sections below cover additional configuration points that commonly cause login or data access issues. If you have not yet configured Grafana authentication with ITRS Analytics, refer to Configure Grafana authentication with ITRS Analytics.
Configure grafana.ini Copied
The domain setting is often left as localhost. Change it to the hostname or FQDN where Grafana is accessed.
Update the relevant fields in grafana.ini. Replace the example hostname and OAuth URLs with your ITRS Analytics server address. Obtain client_secret from your Keycloak obcerv-apps client configuration.
Below is an example of a grafana.ini file:
## The http port to use
http_port = 3000
## The public facing domain name used to access grafana from a browser
domain = ec2-18-171-143-13.eu-west-2.compute.amazonaws.com
#################################### Generic OAuth #######################
[auth.generic_oauth]
name = ITRS Analytics
enabled = true
allow_sign_up = true
client_id = obcerv-apps
client_secret = LZplLkJSag4lPRJhUXGA4OGxqpqV0ZEP
scopes = openid profile email offline_access roles
email_attribute_path = email
login_attribute_path = username
name_attribute_path = full_name
role_attribute_path = contains(roles[*], 'admin') && 'GrafanaAdmin' || 'Editor'
auth_url = https://ec2-18-171-143-13.eu-west-2.compute.amazonaws.com/auth/realms/obcerv/protocol/openid-connect/auth
token_url = https://ec2-18-171-143-13.eu-west-2.compute.amazonaws.com/auth/realms/obcerv/protocol/openid-connect/token
api_url = https://ec2-18-171-143-13.eu-west-2.compute.amazonaws.com/auth/realms/obcerv/protocol/openid-connect/userinfo
tls_skip_verify_insecure = true
Restart Grafana after saving changes.
Configure Keycloak Copied
Valid redirect URLs Copied
Configure valid redirect URLs for the Grafana OAuth client as shown below:
Realm roles mapper Copied
Configure the realm roles mapper as shown below:
Set Token Claim Name to roles:
Grafana user Copied
Create a user in Keycloak with admin role rights:
-
Create a user under Users. Enter an email address. The address does not need to be a valid mailbox.
-
Set a password for the user.
-
Clear the Temporary option so the password does not expire on first login.
-
Under Realm roles, create an
adminrole if it does not already exist.
-
For the Grafana user, assign client roles:
-
Assign realm roles to the user:
The user should have both client and realm roles assigned:
Verify Grafana access Copied
-
Log in to Grafana with the Keycloak user you created.
-
Complete the ITRS Analytics OAuth login when redirected:
-
In Grafana, go to Connections > Data sources and open Explore:
-
Open the Metrics drop-down and start typing a metric name, for example,
cpuutilisation. Matching entries should appear as you type.
-
Click Run query. Data should appear in the results panel: