Maximo Application Suite
Customer-managed

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.

Tip: This task maps to the following Ansible role: cluster_monitoring. For more information, see IBM Maximo Application Suite installation with Ansible collection.

Before you begin

Ensure that the user workload monitoring Prometheus cluster is enabled and configured.

About this task

Use the following storage classes to configure Grafana storage, according to the Cloud Service Provider hosting your Red Hat OpenShift cluster:
Table 1. Storage classes
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.

  1. Configure role-based access control for Grafana.
    The Grafana operator requires permission to scan Maximo Application Suite application namespaces for GrafanaDashboard custom resources.
    1. In the banner, click Import YAML (Plus icon).
    2. 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
    3. Enter the following YAML.
      ---
      apiVersion: v1
      kind: ServiceAccount
      metadata:
        name: grafana-operator
        namespace: openshift-user-workload-monitoring
    4. 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
    5. 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"
    6. 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"
    7. 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
    8. Click Create.
  2. Install the Grafana Operator.
    Follows these steps to install Grafana Operator v5.
    1. In the banner, click Import YAML (Plus icon). 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"
    2. Click Create.
    3. 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 v5
  3. Create the Grafana instance resource.
    1. In the banner, click Import YAML (Plus icon). 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
    2. 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.
  4. 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 output
  5. 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.
  6. Create the Prometheus data source and configure it as the default data source in Grafana.
    1. In the banner, click Import YAML (Plus icon). 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}
    2. Click Create.
  7. 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
  8. Log in to the Grafana console
    http://grafana-route-openshift-user-workload-monitoring.apps.cluster1.example-cluster.com
    1. Click the login icon Login icon. Enter the Grafana admin credentials from the previous step and log in.
    2. On the side navigation, click the dashboards icon 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.
  9. 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:

      1. To load the Grafana Dashboard for Manage, in the Grafana dashboard, download the maximo-dashboard.json file from: maximo-dashboard.zip.
      2. Go to Import it into Dashboards/Manage.
      3. 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.
      4. In the Import via panel json field, enter the JSON data from the file downloaded in step 10.a.
      5. Click the Load button. On the next screen, set the folder name to the namespace of your Manage instance and click the Import button.
      6. 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:

      1. 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.
      2. In the Grafana web interface, from Dashboards > Manage, click Import.
        1. In the Import via panel json field, enter the JSON data from the file maximo-manage-dashboard.json downloaded in step 10.a.
        2. Click Load. On the next screen, set the folder name to the namespace of your Maximo Manage instance and click Import.
      3. In the Grafana web interface, from Dashboards > Manage, click Import.
        1. In the Import via panel json field, enter the JSON data from the file maximo-mvi-dashboard.json downloaded in step 10.a
        2. Click Load. On the next screen, set the folder name to the namespace of your IBM Maximo Visual Inspection Edge instance and click Import.
      4. 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.