Learn how to put your digital team to work with MuleSoft for Agentforce.
Contact Us 1-800-596-4880

Configuring Grafana Dashboards

Monitor the health of your Anypoint Platform Private Cloud Edition (Anypoint Platform PCE) installation and its running applications with Grafana dashboards. These dashboards provide a visual representation of the data collected by the monitoring tools in your Anypoint Platform PCE installation.

The Grafana application uses a Kubernetes service of type NodePort to expose the service to the external network. To access Grafana, configure the load balancer to forward traffic to port 32380.

Alternatively, use the kubectl port-forward command to access Grafana locally:

kubectl -n monitoring port-forward $(kubectl -n monitoring get svc --selector='app.kubernetes.io/name=grafana' -oname | head -n 1) 3000:80

Access the Grafana Dashboard

To retrieve credentials for Grafana, use these commands:

kubectl -n monitoring get secrets grafana-creds -ojsonpath='{.data.admin-user}' | base64 --decode
kubectl -n monitoring get secrets grafana-creds -ojsonpath='{.data.admin-password}' | base64 --decode

Create a Custom Dashboard

You can create custom dashboards in Grafana using its web interface. However, these dashboards are lost if the Grafana pod restarts. To create a custom dashboard that persists across restarts, create a ConfigMap with the label grafana_dashboard=1.

This example demonstrates how to create a ConfigMap with a custom dashboard:

  1. Create a file with the dashboard configuration, for example, example-redis.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-custom-dashboard
  namespace: monitoring
  labels:
    grafana_dashboard: "1"
data:
  example-redis.json: |
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      "timezone": "browser",
      "title": "My Example Redis Dashboard",
      "description": "",
      "editable": true,
      "gnetId": null,
      "graphTooltip": 0,
      "id": 29,
      "iteration": 1645573265624,
      "links": [],
      "panels": [
        {
          "aliasColors": {
            "Max": "#890F02",
            "Used": "#7EB26D",
            "max": "#BF1B00"
          },
          "bars": false,
          "dashes": false,
          "datasource": null,
          "editable": false,
          "error": false,
          "fieldConfig": {
            "defaults": {},
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "hiddenSeries": false,
          "id": 7,
          "isNew": true,
          "legend": {
            "avg": false,
            "current": false,
            "hideEmpty": false,
            "hideZero": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "gridPos": {
            "x": 0,
            "y": 0,
            "h": 11,
            "w": 24
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "null as zero",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.5.10",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "exemplar": true,
              "expr": "sum by (pod)(redis_used_memory{pod=~\"$pod\"})",
              "interval": "",
              "legendFormat": "{{pod}}",
              "refId": "B"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Memory Usage",
          "tooltip": {
            "msResolution": false,
            "shared": true,
            "sort": 0,
            "value_type": "cumulative"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "bytes",
              "label": "",
              "logBase": 1,
              "max": null,
              "min": 0,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": false
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        }
      ],
      "refresh": false,
      "schemaVersion": 27,
      "style": "dark",
      "tags": [],
      "templating": {
        "list": [
          {
            "allValue": null,
            "current": {
              "selected": false,
              "text": "All",
              "value": "$__all"
            },
            "datasource": null,
            "definition": "label_values(redis_maxmemory, pod)",
            "description": null,
            "error": null,
            "hide": 0,
            "includeAll": true,
            "label": "Pod",
            "multi": true,
            "name": "pod",
            "options": [],
            "query": {
              "query": "label_values(redis_maxmemory, pod)",
              "refId": "StandardVariableQuery"
            },
            "refresh": 2,
            "regex": "",
            "skipUrlSync": false,
            "sort": 0,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
          }
        ]
      },
      "time": {
        "from": "now-6h",
        "to": "now"
      },
      "timepicker": {
        "refresh_intervals": [
          "5s",
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ],
        "time_options": [
          "5m",
          "15m",
          "1h",
          "6h",
          "12h",
          "24h",
          "2d",
          "7d",
          "30d"
        ]
      }
    }
  1. Create the ConfigMap with the following command:

kubectl apply -f example-redis.yaml

To update the dashboard, modify the ConfigMap, and the dashboard updates automatically.

Delete a Custom Dashboard

To delete a custom dashboard, delete the corresponding ConfigMap. The dashboard associated with the ConfigMap is removed automatically.

kubectl -n monitoring delete cm my-custom-dashboard

List All Persistent Dashboards

To get a list of all ConfigMaps with the label grafana_dashboard=1, use this command:

kubectl get configmaps --selector='grafana_dashboard=1' -A