Installing Grafana
Red Hat® OpenShift® Container Platform is preconfigured with a Grafana instance for visualizing Prometheus metrics from compute nodes in the cluster. This Grafana instance is reserved for OCP cluster metrics, such as compute node CPU, memory, disk, and I/O metrics. Maximo® Application Suite applications cannot use the base Grafana instance. You can install another Grafana instance to host dashboards for Maximo Application Suite applications.
For more information about Red Hat OpenShift monitoring, see Red Hat OpenShift Container Platform : Accessing third-party UIs.
Not required to install Maximo Application Suite, but required for monitoring Maximo Application Suite.
Before you begin
About this task
Cloud Service Provider | Grafana Storage Classes - ${GRAFANA_STORAGE_CLASS} |
---|---|
On premises | ocs-storagecluster-cephfs |
Amazon Web Services | ocs-storagecluster-cephfs |
Microsoft Azure | |
IBM Cloud® | ibmc-block-bronze |
Procedure
Install by using the Red Hat OpenShift Container Platform web console.
-
Configure role-based access control for Grafana.
The Grafana operator requires permission to scan Maximo Application Suite application namespaces for GrafanaDashboard custom resources.
-
In the banner, click Import YAML (
).
-
Enter the following YAML.
--- apiVersion: operators.coreos.com/v1alpha2 kind: OperatorGroup metadata: name: grafana-operator namespace: openshift-user-workload-monitoring spec: targetNamespaces: - openshift-user-workload-monitoring
-
Enter the following YAML.
--- apiVersion: v1 kind: ServiceAccount metadata: name: grafana-operator namespace: openshift-user-workload-monitoring
-
Enter the following YAML.
--- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: grafana-operator rules: - apiGroups: - "" resources: - pods - services - endpoints - persistentvolumeclaims - configmaps - secrets - serviceaccounts - configmaps verbs: - get - list - create - update - delete - deletecollection - watch - apiGroups: - "" resources: - events verbs: - get - list - watch - create - delete - update - patch - apiGroups: - apps resources: - deployments - deployments/finalizers - daemonsets - replicasets - statefulsets verbs: - get - list - create - update - delete - deletecollection - watch - apiGroups: - route.openshift.io resources: - routes - routes/custom-host verbs: - get - list - create - update - delete - deletecollection - watch - create - apiGroups: - extensions resources: - ingresses verbs: - get - list - create - update - delete - deletecollection - watch - apiGroups: - integreatly.org resources: - grafanas - grafanas/status - grafanas/finalizers - grafanadashboards - grafanadatasources - grafanadatasources/status verbs: - get - list - create - update - delete - deletecollection - watch - apiGroups: - networking.k8s.io resources: - ingresses verbs: - get - list - create - update - delete - deletecollection - watch - create
-
Enter the following YAML.
--- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: aggregate-grafana-admin-edit labels: rbac.authorization.k8s.io/aggregate-to-admin: "true" rbac.authorization.k8s.io/aggregate-to-edit: "true" rules: - apiGroups: - "integreatly.org" resources: - grafanas - grafanas/status - grafanas/finalizers - grafanadashboards - grafanadatasources - grafanadatasources/status verbs: - "get" - "list" - "watch" - "create" - "update" - "patch" - "delete" - "deletecollection"
-
Enter the following YAML.
--- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: aggregate-grafana-view labels: rbac.authorization.k8s.io/aggregate-to-view: "true" rbac.authorization.k8s.io/aggregate-to-cluster-reader: "true" rules: - apiGroups: - "integreatly.org" resources: - grafanas - grafanas/status - grafanas/finalizers - grafanadashboards - grafanadatasources - grafanadatasources/status verbs: - "get" - "list" - "watch"
-
Enter the following YAML.
--- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: grafana-operator roleRef: name: grafana-operator kind: ClusterRole apiGroup: "" subjects: - kind: ServiceAccount name: grafana-operator namespace: openshift-user-workload-monitoring
- Click Create.
-
In the banner, click Import YAML (
-
Install the Grafana Operator. Follows these steps to install Grafana Operator v5.
-
In the banner, click Import YAML (
). Enter the following YAML.
--- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: grafana-operator namespace: openshift-user-workload-monitoring labels: operators.coreos.com/grafana-operator.openshift-user-workload-monitoring spec: channel: v5 installPlanApproval: Automatic name: grafana-operator source: community-operators sourceNamespace: openshift-marketplace config: env: - name: "WATCH_NAMESPACE" value: "" - name: "DASHBOARD_NAMESPACES_ALL" value: "true"
- Click Create.
-
Verify that the Grafana operator installed successfully.
oc get csv -n openshift-user-workload-monitoring -l operators.coreos.com/grafana-operator.openshift-user-workload-monitoring=""
Sample output for v5NAME DISPLAY VERSION REPLACES PHASE grafana-operator.v5.6.3 Grafana Operator 5.6.3 grafana-operator.v5.6.2 Succeeded
-
In the banner, click Import YAML (
-
Create the Grafana instance resource.
-
In the banner, click Import YAML (
). Enter the following YAML to create the Grafana instance resource.
Note:- Replace
${GRAFANA_STORAGE_CLASS}
by the corresponding Grafana Storage Class from the preceding table according to your Cloud Service Provider hosting your installation. - Any storage class that supports RWX access mode and file system volume mode is sufficient. The I/O requirements for the Grafana persistent volumes are not significant.
--- apiVersion: grafana.integreatly.org/v1beta1 kind: Grafana metadata: name: mas-grafana namespace: openshift-user-workload-monitoring labels: dashboards: "grafanav5" spec: config: auth: disable_login_form: "false" disable_signout_menu: "true" log: level: warn mode: console dataStorage: accessModes: - ReadWriteOnce class: ${GRAFANA_STORAGE_CLASS} size: 20Gi deployment: strategy: type: Recreate spec: replicas: 3 template: spec: containers: - name: grafana readinessProbe: httpGet: path: /api/health port: 3000 scheme: HTTP failureThreshold: 5 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 20 livenessProbe: httpGet: path: /api/health port: 3000 scheme: HTTP failureThreshold: 5 initialDelaySeconds: 60 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 20
- Replace
-
Click Create.
On the Workloads Deployments page, switch to the openshift-user-workload-monitoring project and wait for the grafana-deployment deployment to indicate that three pods are in Ready state.
-
In the banner, click Import YAML (
-
Add the cluster-monitoring-view cluster role to the Grafana service account.
oc adm policy add-cluster-role-to-user cluster-monitoring-view -z grafana-serviceaccount -n openshift-user-workload-monitoring
Sample outputclusterrole.rbac.authorization.k8s.io/cluster-monitoring-view added: "grafana-serviceaccount"
-
Get the Bearer token from the grafana-serviceaccount service account.
oc sa get-token grafana-serviceaccount -n openshift-user-workload-monitoring
Save this Bearer token. You need it to create the Prometheus data source in the next step. -
Create the Prometheus data source and configure it as the default data source in Grafana.
-
In the banner, click Import YAML (
). Enter the following YAML to create the GrafanaDataSource resource:
Replace
${TOKEN}
with the Bearer token from the previous step.--- apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDatasource metadata: name: mas-prom-grafanadatasource namespace: openshift-user-workload-monitoring spec: instanceSelector: matchLabels: dashboards: "grafanav5" datasource: name: prometheus type: prometheus access: proxy url: https://thanos-querier.openshift-monitoring.svc.cluster.local:9091 isDefault: true editable: true jsonData: httpHeaderName1: Authorization timeInterval: 5s tlsSkipVerify: true secureJsonData: httpHeaderValue1: Bearer ${TOKEN}
- Click Create.
-
In the banner, click Import YAML (
-
Get the Grafana admin credentials from the grafana-admin-credentials
secret.
oc get secret grafana-admin-credentials -n openshift-user-workload-monitoring -o jsonpath='{.data.GF_SECURITY_ADMIN_USER}' | base64 -d ; echo
oc get secret grafana-admin-credentials -n openshift-user-workload-monitoring -o jsonpath='{.data.GF_SECURITY_ADMIN_PASSWORD}' | base64 -d ; echo
-
Log in to the Grafana console
http://grafana-route-openshift-user-workload-monitoring.apps.cluster1.example-cluster.com
-
Click the login icon
. Enter the Grafana admin credentials from the previous step and log in.
-
On the side navigation, click the dashboards icon
then click Manage.
Grafana resources that are created during application installation are imported by the Grafana operator. The GrafanaDashboard scans resources across all namespaces and the resources are now visible. Dashboards are organized into folders that correspond to namespaces. Expand a folder to see dashboards. -
Click the login icon
- Loading the Maximo Manage dashboard into Grafana.
-
The IBM® Maximo Manage application does not include a dashboard however you can create a dashboard for Manage by using the following steps:
- To load the Grafana Dashboard for Manage, in the Grafana dashboard, download the maximo-dashboard.json file from: maximo-dashboard.zip.
- Go to Import it into Dashboards/Manage.
- Click the Import button. Note that you see the Import option only when you log in as the admin user that you entered when you created the Grafana instance.
- In the Import via panel json field, enter the JSON data from the file downloaded in step 10.a.
- Click the Load button. On the next screen, set the folder name to the namespace of your Manage instance and click the Import button.
- You will now see your Manage dashboards.
-
The IBM Maximo Manage and IBM Maximo Visual Inspection applications do not include a dashboard. However, you can create dashboards for Maximo Manage and Maximo Visual Inspection by using the following steps:
- To load the Grafana Dashboard for Maximo Manage and Maximo Visual Inspection, in the Grafana dashboard, download the maximo-manage-dashboard.json and maximo-mvi-dashboard.json files from: maximo-dashboard.zip.
- In the Grafana web interface, from Dashboards >
Manage, click Import.
- In the Import via panel json field, enter the JSON data from the file maximo-manage-dashboard.json downloaded in step 10.a.
- Click Load. On the next screen, set the folder name to the namespace of your Maximo Manage instance and click Import.
- In the Grafana web interface, from Dashboards >
Manage, click Import.
- In the Import via panel json field, enter the JSON data from the file maximo-mvi-dashboard.json downloaded in step 10.a
- Click Load. On the next screen, set the folder name to the namespace of your IBM Maximo Visual Inspection Edge instance and click Import.
- You will now see your Maximo Manage and Maximo Visual Inspection dashboards.
Note: Starting in Maximo Visual Inspection 8.8, the Grafana dashboard is installed automatically.
-
What to do next
No configuration required in Maximo Application Suite. PodMonitor and ServiceMonitor resources that are created by Maximo Application Suite and Maximo Application Suite applications are automatically registered with the user workload Prometheus cluster. Maximo Application Suite metrics are scraped by Prometheus.