Configure the CockroachDB data source
To install a data source, see Install Grafana plugins. For general information on adding a data source see Add a data source.
Only users with the organization administrator
role can add data sources. Administrators can also configure the data source via YAML with Grafana’s provisioning system.
To install the CockroachDB plugin, see Installation on the CockroachDB plugin page.
You will need your host URL, default database and authentication information. To find your host URL and default database log in to the CockroachDB Cloud Console, select your cluster and navigate to the Connection Info section. For SQL authentication you need your username and password, for Kerberos authentication you need your user name and credential cache path and for TLS/SSL authentication you need the file path or file content of a root certificate, client certificate and client key.
Note: For Kerberos authentication, the credentials cache file must be in a location accessible by the user running Grafana.
Configure the data source with provisioning
It is possible to configure data sources using configuration files with Grafana’s provisioning system. To read about how it works, including and all the settings that you can set for this data source, refer to Provisioning Grafana data sources.
Here are some provisioning examples for this data source:
- Using SQL authentication:
apiVersion: 1
datasources:
- name: CockroachDB
type: grafana-cockroachdb-datasource
jsonData:
url: your_host_url
database: your_default_database
user: your_user_name
queryTimeout: 30 # Optional: query timeout in seconds (default: 30, range: 5-600)
secureJsonData:
password: your_password
- Using Kerberos authentication:
apiVersion: 1
datasources:
- name: CockroachDB
type: grafana-cockroachdb-datasource
jsonData:
url: your_host_url
database: your_default_database
user: your_user_name
credentialCache: your_credential_cache_file_path
configFilePath: /etc/krb5.conf (by default)
queryTimeout: 60 # Optional: query timeout in seconds
- Using TLS/SSL authentication:
Note
TLS values can be either a file path or the file content of the certificate and key
apiVersion: 1
datasources:
- name: CockroachDB
type: grafana-cockroachdb-datasource
jsonData:
url: your_host_url
database: your_default_database
user: your_user_name
queryTimeout: 45 # Optional: query timeout in seconds
secureJsonData:
tlsCACert: your_tls_ca_cert
tlsClientCert: your_tls_client_cert
tlsClientKey: your_tls_client_key
password: your_password
Configuration Options
The CockroachDB data source supports the following configuration options:
- Query Timeout: Controls how long queries can run before timing out (5-600 seconds, default: 30 seconds)
- Connection Limits: Configure maximum open connections, idle connections, and connection lifetime
- Authentication: Support for SQL, Kerberos, and TLS/SSL authentication methods