Configure the ServiceNow data source
This document explains how to configure the ServiceNow data source in Grafana, set up authentication, and prepare your ServiceNow instance.
Before you begin
Before configuring the data source, ensure you have:
- Grafana permissions: Organization administrator role.
- Grafana version: 11.6.7 or later.
- ServiceNow account: A user account with access to the tables you want to query. Grafana recommends creating a dedicated user or using a service account.
- Grafana license: Grafana Cloud Pro, Advanced, or a Pro trial, or Grafana Enterprise with an activated license.
Add the data source
To add the ServiceNow data source:
- Click Connections in the left-side menu.
- Click Add new connection.
- Type
ServiceNowin the search bar. - Select ServiceNow.
- Click Add new data source.
Configure authentication
The ServiceNow data source supports two authentication methods. Select the method from the Authentication Type drop-down.
Basic authentication
Basic authentication uses a ServiceNow username and password.
OAuth authentication
OAuth authentication uses a ServiceNow username and password along with an OAuth Client ID and Client Secret.
Configure additional settings
The data source provides the following additional settings:
Custom headers
You can add custom HTTP headers that are sent with every request to ServiceNow. Use custom headers when your ServiceNow instance requires additional headers for proxy configurations or custom middleware.
Secure socks proxy
If your Grafana instance has the secure socks proxy feature enabled, you can toggle Enabled under Secure Socks Proxy to route data source connections through the proxy.
HTTP proxy
When routing Grafana traffic through an HTTP proxy, set one of the following environment variables on the Grafana server:
HTTP_PROXY(orhttp_proxy):http://<HOST>:<PORT>HTTPS_PROXY(orhttps_proxy):https://<HOST>:<PORT>
Verify the connection
Click Save & test to verify the connection. A successful connection displays Plugin health check successful.
When Use Sys Tables? is enabled, the health check verifies access to each required system table and provides specific error messages if any permissions are missing. Refer to Troubleshoot ServiceNow for solutions to common health check errors.
Configure ServiceNow permissions
To use the Use Sys Tables? option, the ServiceNow user needs read access to the following tables:
Note
Grant the ServiceNow user access only to the tables it needs. If the user has access to too many tables, you may encounter performance issues in the query editor.
Set up a ServiceNow user with ACL rules
The following steps require ServiceNow administrator access and are performed in your ServiceNow instance. These steps are only necessary when the Use Sys Tables? option is enabled. For more information about elevated privileges and ACL rules, refer to the ServiceNow elevated privilege documentation.
Elevate the administrator user to
security_admin:- Click the profile icon in the top-right navigation.
- Click Elevate Roles.
- Check the box next to security_admin.
- Click OK.
Create a role for Grafana:
- Navigate to System Security > Users and Groups > Roles.
- Click New.
- Enter a name (for example,
grafana_reader_role) and description. - Click Submit.
Create or update a user for Grafana:
- Create a new user (for example,
grafana_user) or select an existing user. - Assign the role you created in step 2 to this user.
- Create a new user (for example,
Create ACL rules for the required system tables:
- Create a table-level read ACL for
sys_db_object:- Navigate to System Security > Access Control (ACL).
- In the Name column, search for
sys_db_objectand select the Table record. - Select the Controls tab.
- In the Access Controls section, click New.
- Set Operation to read.
- In the Requires Role section, add the role you created.
- Click Submit.
- Create field-level read ACLs for
sys_db_object. Repeat for each field: Name, Label, Display Name, and Extends table:- On the
sys_db_objecttable record, select the Columns tab. - Select the field.
- In the Access Controls section, click New.
- Set Operation to read.
- Add the role you created.
- Click Submit.
- On the
- Create table-level read ACLs for
sys_dictionary,sys_choice,sys_glide_object, andincidentusing the same process as step 4.1.
- Create a table-level read ACL for
Add read access for any additional tables you want to query from Grafana (for example,
change_request).
Note
If you don’t have the ITSM Roles plugin, you can alternatively grant the Grafana user admin privileges to access all tables. This approach is strongly discouraged for production environments.
Developer instance
To create a ServiceNow developer instance for testing, go to the ServiceNow Developer page.
Provision the data source
You can define the data source using YAML files as part of Grafana’s provisioning system. For more information, refer to Provisioning Grafana.
Basic authentication example
Refer to the Provisioning configuration reference for all available keys.
apiVersion: 1
datasources:
- name: ServiceNow
type: grafana-servicenow-datasource
access: proxy
url: https://<INSTANCE_ID>.service-now.com
basicAuthUser: <USERNAME>
jsonData:
authMethod: basicAuth
useSysTables: true
queryTimeoutSeconds: 30
secureJsonData:
basicAuthPassword: <PASSWORD>OAuth authentication example
apiVersion: 1
datasources:
- name: ServiceNow
type: grafana-servicenow-datasource
access: proxy
url: https://<INSTANCE_ID>.service-now.com
basicAuthUser: <USERNAME>
jsonData:
authMethod: serviceNowOAuth
oauthClientID: <CLIENT_ID>
useSysTables: true
queryTimeoutSeconds: 30
secureJsonData:
basicAuthPassword: <PASSWORD>
oauthClientSecret: <CLIENT_SECRET>Terraform example
You can provision the ServiceNow data source using the Grafana Terraform provider. The following example configures the data source with OAuth authentication:
resource "grafana_data_source" "servicenow" {
type = "grafana-servicenow-datasource"
name = "ServiceNow"
url = "https://<INSTANCE_ID>.service-now.com"
basic_auth_enabled = true
basic_auth_username = "<USERNAME>"
secure_json_data_encoded = jsonencode({
basicAuthPassword = "<PASSWORD>"
oauthClientSecret = "<CLIENT_SECRET>"
})
json_data_encoded = jsonencode({
authMethod = "serviceNowOAuth"
oauthClientID = "<CLIENT_ID>"
useSysTables = true
queryTimeoutSeconds = 30
})
}For basic authentication, set authMethod to basicAuth and omit the OAuth fields.
Provisioning configuration reference
The following tables list all available provisioning keys:
jsonData fields:
secureJsonData fields:
Note
Older versions of the plugin used
oauthEnabled: trueinjsonDatainstead ofauthMethod: serviceNowOAuth. This configuration is still supported but deprecated. UseauthMethodinstead.


