Creating Grafana Data Source

The OpenShift® administrator can create the Grafana Data Source to point to the Prometheus instance, and pull the data from the Prometheus instance into the Grafana dashboards.

Procedure

  1. Log in to the OpenShift Container Platform (OCP) by using the OpenShift administrator credentials.
  2. In the left panel, go to Operators > Installed Operators. Select the project where you installed Grafana operator.
  3. Click the Grafana Operator link from the Name column, and click the Grafana Data Source tab.
  4. Click Create GrafanaDataSource.
  5. Enter the following details in the YAML file:
    • name: Enter the name of the Grafana Data Source. Refer to the example, wherein the Grafana Data Source name is entered as example-grafanadatasource.
    • namespace: Enter the name of the project or the namespace where you installed Grafana operator. Refer to the example, wherein the Grafana namespace name is entered as test01.
    • url: Enter the Prometheus route URL.
    Example:
    apiVersion: integreatly.org/v1alpha1
    kind: GrafanaDataSource
    metadata:
      name: example-grafanadatasource
      namespace: test01
    spec:
      datasources:
        - access: proxy
          editable: true
          isDefault: true
          jsonData:
            timeInterval: 5s
          name: Prometheus
          type: prometheus
          url: <Prometheus route URL>
          version: 1
      name: example-datasources.yaml
    

What to do next

Verify Prometheus data source from Grafana.