Grafana dashboard: Prometheus Alerts
Description: Dashboard showing Prometheus Alerts (both pending and firing) for alerts adjustment and debugging

based on 11098

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.5.0"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph (old)",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      },
      {
        "datasource": {
          "uid": "$datasource"
        },
        "enable": true,
        "expr": "ALERTS_FOR_STATE{instance=~\"$instance\", alertname=~\"$alertname\"} * 1000",
        "hide": false,
        "iconColor": "#37872D",
        "limit": 100,
        "name": "Alerts annotations:",
        "showIn": 0,
        "step": "2s",
        "tagKeys": "alertname",
        "tags": [],
        "textFormat": "",
        "titleFormat": "{{instance}}",
        "type": "tags",
        "useValueForTime": true
      },
      {
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(255, 96, 96, 1)",
        "limit": 100,
        "name": "Display comments",
        "showIn": 0,
        "tags": [
          "note"
        ],
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [
            "note"
          ],
          "type": "tags"
        },
        "type": "tags"
      }
    ]
  },
  "description": "Dashboard showing Prometheus Alerts (both pending and firing) for alerts adjustment and debugging",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 18458,
  "graphTooltip": 1,
  "id": null,
  "iteration": 1680839112402,
  "links": [
    {
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "OS"
      ],
      "type": "dashboards"
    },
    {
      "icon": "external link",
      "tags": [
        "alerts-advanced"
      ],
      "type": "dashboards"
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 10,
      "gridPos": {
        "h": 10,
        "w": 17,
        "x": 0,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 440,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "8.5.0",
      "pointradius": 1,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "/firing/",
          "stack": "B",
          "transform": "negative-Y",
          "zindex": -3
        },
        {
          "alias": "/pending/",
          "stack": "A"
        },
        {
          "alias": ""
        },
        {
          "alias": "/help_series_x_axes_in_center/",
          "bars": false,
          "hideTooltip": true,
          "legend": false,
          "lines": false,
          "stack": false,
          "yaxis": 2
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "expr": "ALERTS{instance=~\"$instance\", alertname=~\"$alertname\", alertstate=~\"$alertstate\"}",
          "legendFormat": "{{alertname}} {{instance}} {{alertstate}} {{datacenter}}",
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "expr": "1",
          "hide": false,
          "legendFormat": "help_series_x_axes_in_center",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Alerts History",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": "Firing (-)   /  Pending (+)  ",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "max": "1",
          "min": "-1",
          "show": false
        }
      ],
      "yaxis": {
        "align": true,
        "alignLevel": 0
      }
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "Alerts list for all alerts in a selected time range. For filling this table `Alerts annotations` have to be switched on.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "decimals": 2,
          "displayName": "",
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "short"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "time"
              },
              {
                "id": "unit",
                "value": "time: YYYY-MM-DD HH:mm:ss"
              },
              {
                "id": "custom.align",
                "value": "left"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "^((?!^alertname|^instance|^severity|^count|^time).)*$"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "alertname"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 161
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 10,
        "w": 7,
        "x": 17,
        "y": 0
      },
      "id": 442,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.5.0",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_PROMETHEUS}"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "ALERTS_FOR_STATE{instance=~\"$instance\",alertname=~\"$alertname\"}*1000",
          "format": "table",
          "instant": true,
          "range": false,
          "refId": "A"
        }
      ],
      "title": "Alerts Start List",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {
              "Time": 1,
              "Value": 0,
              "alertname": 2,
              "instance": 3,
              "job": 4,
              "severity": 5
            },
            "renameByName": {}
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_PROMETHEUS}"
      },
      "description": "Shows how many times was particular alert started in a defined time range. Alert can be started either directly as `firing` or as a `pending`. Pending alerts wait for a defined time before it flips to a `firing` alert. This is specified with the `FOR` clause in a Prometheus `rules` file.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Time"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Time"
              },
              {
                "id": "custom.align"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "instance"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 2
              },
              {
                "id": "custom.align"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "count"
              },
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "custom.align"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "^((?!^alertname|^instance|^severity|^count).)*$"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 24,
        "x": 0,
        "y": 10
      },
      "id": 414,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "count"
          }
        ]
      },
      "pluginVersion": "8.5.0",
      "targets": [
        {
          "expr": "changes( ALERTS_FOR_STATE{instance=~\"$instance\",alertname=~\"$alertname\"}[$__range] ) + 1",
          "format": "table",
          "hide": false,
          "instant": true,
          "refId": "B",
          "datasource": "${DS_PROMETHEUS}"
        }
      ],
      "title": "Total Alert Counts",
      "transformations": [
        {
          "id": "merge",
          "options": {
            "reducers": []
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 36,
  "style": "dark",
  "tags": [
    "prometheus",
    "alerts"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "default",
          "value": "default"
        },
        "hide": 2,
        "includeAll": false,
        "label": "Prometheus datasource",
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "$datasource"
        },
        "definition": "label_values(ALERTS_FOR_STATE,instance)",
        "hide": 0,
        "includeAll": true,
        "label": "Instance:",
        "multi": true,
        "name": "instance",
        "options": [],
        "query": {
          "query": "label_values(ALERTS_FOR_STATE,instance)",
          "refId": "Prometheus-instance-Variable-Query"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(ALERTS_FOR_STATE,alertname)",
        "hide": 0,
        "includeAll": true,
        "label": "Alert:",
        "multi": true,
        "name": "alertname",
        "options": [],
        "query": {
          "query": "label_values(ALERTS_FOR_STATE,alertname)",
          "refId": "Prometheus-alertname-Variable-Query"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {},
        "datasource": {
          "type": "prometheus",
          "uid": "${DS_PROMETHEUS}"
        },
        "definition": "label_values(ALERTS, alertstate)",
        "hide": 0,
        "includeAll": true,
        "label": "State:",
        "multi": true,
        "name": "alertstate",
        "options": [],
        "query": {
          "query": "label_values(ALERTS, alertstate)",
          "refId": "Prometheus-alertstate-Variable-Query"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "datasource": {
          "uid": " Thanos Trickster"
        },
        "filters": [],
        "hide": 0,
        "label": "",
        "name": "Filters",
        "skipUrlSync": false,
        "type": "adhoc"
      }
    ]
  },
  "time": {
    "from": "now-2d",
    "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"
    ]
  },
  "timezone": "",
  "title": "Prometheus Alerts",
  "uid": "eea-9_sik",
  "version": 4,
  "weekStart": ""
}