Grafana dashboard: Grafana Alert Dashboard

Grafana database configuration:
 - GF_DATABASE_TYPE: "mysql"
 - GF_DATABASE_URL: "mysql://USER:PASS@HOST:3306/DB"

Grafana datasource configuration:
- Type: Mysql
- Host: HOST
- Database: DB
- User: USER
- Password: PASS

{
  "__inputs": [],
  "__requires": [
    {
      "type": "panel",
      "id": "alertlist",
      "name": "Alert List",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.6.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 3489,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [],
  "rows": [
    {
      "collapse": false,
      "height": "180",
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(255, 255, 255, 0.9)",
            "rgba(50, 172, 45, 0.97)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "$datasource",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 10,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  IFNULL(max(UNIX_TIMESTAMP(new_state_date)),0) as time_sec,\n  IFNULL(count(name), 0) as value\nFROM alert\nWHERE state = \"ok\"\nORDER BY time_sec ASC\n",
              "refId": "A"
            }
          ],
          "thresholds": "1,1",
          "title": "OK",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(255, 255, 255, 0.97)",
            "rgba(245, 54, 54, 0.9)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "$datasource",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 11,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  IFNULL(max(UNIX_TIMESTAMP(new_state_date)),0) as time_sec,\n  IFNULL(count(name), 0) as value\nFROM alert\nWHERE state = \"alerting\"\nORDER BY time_sec ASC\n",
              "refId": "A"
            }
          ],
          "thresholds": "1,1",
          "title": "Alerting",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(255, 255, 255, 0.97)",
            "rgba(245, 54, 54, 0.9)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "datasource": "$datasource",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 13,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  IFNULL(max(UNIX_TIMESTAMP(new_state_date)),0) as time_sec,\n  IFNULL(count(name), 0) as value\nFROM alert\nWHERE state = \"execution_error\"\nORDER BY time_sec ASC\n",
              "refId": "A"
            }
          ],
          "thresholds": "1,1",
          "title": "Exec Error",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(255, 255, 255, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(237, 129, 40, 0.89)"
          ],
          "datasource": "$datasource",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 14,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  IFNULL(max(UNIX_TIMESTAMP(new_state_date)),0) as time_sec,\n  IFNULL(count(name), 0) as value\nFROM alert\nWHERE state = \"paused\"\nORDER BY time_sec ASC\n",
              "refId": "A"
            }
          ],
          "thresholds": "1,1",
          "title": "Paused",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": true,
          "colors": [
            "rgba(255, 255, 255, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(237, 129, 40, 0.89)"
          ],
          "datasource": "$datasource",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 15,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  IFNULL(max(UNIX_TIMESTAMP(new_state_date)),0) as time_sec,\n  IFNULL(count(name), 0) as value\nFROM alert\nWHERE state = \"pending\"\nORDER BY time_sec ASC\n",
              "refId": "A"
            }
          ],
          "thresholds": "1,1",
          "title": "Pending",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "datasource": "$datasource",
          "format": "percentunit",
          "gauge": {
            "maxValue": 1,
            "minValue": 0,
            "show": true,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 17,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  IFNULL(max(UNIX_TIMESTAMP(new_state_date)),0) as time_sec,\n  (SELECT IFNULL(count(name), 0) FROM alert WHERE state = 'ok')/(SELECT IFNULL(count(name), 1) FROM alert) as value\nFROM alert\nORDER BY time_sec ASC\n",
              "refId": "A"
            }
          ],
          "thresholds": "0.9,0.95",
          "title": "Health",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "avg"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    },
    {
      "collapse": false,
      "height": "200",
      "panels": [
        {
          "height": "",
          "id": 16,
          "limit": 10,
          "links": [],
          "onlyAlertsOnDashboard": false,
          "show": "changes",
          "sortOrder": 1,
          "span": 12,
          "stateFilter": [],
          "title": "Last Change",
          "type": "alertlist"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    },
    {
      "collapse": true,
      "height": "",
      "panels": [
        {
          "height": "836px",
          "id": 1,
          "limit": 10,
          "links": [],
          "onlyAlertsOnDashboard": false,
          "show": "current",
          "sortOrder": 1,
          "span": 6,
          "stateFilter": [
            "ok"
          ],
          "title": "OK",
          "transparent": false,
          "type": "alertlist"
        },
        {
          "height": "200px",
          "id": 9,
          "limit": 10,
          "links": [],
          "onlyAlertsOnDashboard": false,
          "show": "current",
          "sortOrder": 1,
          "span": 6,
          "stateFilter": [
            "paused"
          ],
          "title": "Paused",
          "type": "alertlist"
        },
        {
          "height": "200px",
          "id": 6,
          "limit": 10,
          "links": [],
          "onlyAlertsOnDashboard": false,
          "show": "current",
          "sortOrder": 1,
          "span": 6,
          "stateFilter": [
            "alerting"
          ],
          "title": "Alerting",
          "type": "alertlist"
        },
        {
          "height": "200px",
          "id": 8,
          "limit": 10,
          "links": [],
          "onlyAlertsOnDashboard": false,
          "show": "current",
          "sortOrder": 1,
          "span": 6,
          "stateFilter": [
            "no_data"
          ],
          "title": "No Data",
          "type": "alertlist"
        },
        {
          "height": "200px",
          "id": 7,
          "limit": 10,
          "links": [],
          "onlyAlertsOnDashboard": false,
          "show": "current",
          "sortOrder": 1,
          "span": 6,
          "stateFilter": [
            "execution_error"
          ],
          "title": "Execution Error",
          "type": "alertlist"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": true,
      "title": "alert list",
      "titleSize": "h6"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [
    "alert"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "grafana",
          "value": "grafana"
        },
        "hide": 0,
        "label": "datasource",
        "name": "datasource",
        "options": [],
        "query": "mysql",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "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": "Grafana Alert Dashboard",
  "version": 69
}