Grafana dashboard: OpenNMS Event Maintenance
Description: Visualize events stored by OpenNMS in PostgreSQL

### Installation

Create a PostgreSQL datasource for the OpenNMS PostgreSQL database. The user needs SELECT access to the opennms schema.

### Changelog

  * Revision 2
    * Backport for Grafana 4.6.0

{
  "__inputs": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.6.0"
    },
    {
      "type": "panel",
      "id": "grafana-piechart-panel",
      "name": "Pie Chart",
      "version": "1.2.0"
    },
    {
      "type": "panel",
      "id": "heatmap",
      "name": "Heatmap",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Visualize events stored by OpenNMS in PostgreSQL",
  "editable": true,
  "gnetId": 6051,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [
    {
      "icon": "dashboard",
      "keepTime": true,
      "tags": [],
      "title": "OpenNMS",
      "tooltip": "",
      "type": "link",
      "url": "dashboard/db/opennms-dashboard"
    },
    {
      "icon": "external link",
      "tags": [],
      "title": "OpenNMS Wiki",
      "type": "link",
      "url": "https://wiki.opennms.org/wiki/Event_Maintenance"
    }
  ],
  "refresh": false,
  "rows": [
    {
      "collapse": false,
      "height": 250,
      "panels": [
        {
          "aliasColors": {},
          "cacheTimeout": null,
          "combine": {
            "label": "Others",
            "threshold": 0
          },
          "datasource": "$postgresql",
          "fontSize": "80%",
          "format": "short",
          "id": 2,
          "interval": null,
          "legend": {
            "header": "",
            "percentage": true,
            "show": true,
            "values": true
          },
          "legendType": "Right side",
          "links": [],
          "maxDataPoints": 3,
          "nullPointMode": "connected",
          "pieType": "pie",
          "span": 12,
          "strokeWidth": 1,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n    MAX(eventtime) AS \"time\",\n    COUNT(eventID) AS \"tally\",\n    eventUEI AS \"metric\"\nFROM events\nWHERE\n    $__timeFilter(eventtime)\nGROUP BY\n    eventUEI\nORDER BY tally DESC\nLIMIT 10\n",
              "refId": "A"
            }
          ],
          "title": "Top 10 events",
          "type": "grafana-piechart-panel",
          "valueName": "current"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Top 10 events",
      "titleSize": "h6"
    },
    {
      "collapse": true,
      "height": "250px",
      "panels": [
        {
          "cards": {
            "cardPadding": null,
            "cardRound": null
          },
          "color": {
            "cardColor": "#b4ff00",
            "colorScale": "sqrt",
            "colorScheme": "interpolateGnBu",
            "exponent": 0.5,
            "mode": "spectrum"
          },
          "dataFormat": "timeseries",
          "datasource": "$postgresql",
          "heatmap": {},
          "highlightCards": true,
          "id": 1,
          "legend": {
            "show": true
          },
          "links": [],
          "span": 12,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n    $__time(eventtime),\n    1 AS value\nFROM events\nWHERE\n    $__timeFilter(eventtime)\nORDER BY eventtime\n",
              "refId": "A"
            }
          ],
          "title": "Event distribution",
          "tooltip": {
            "show": true,
            "showHistogram": true
          },
          "tooltipDecimals": 0,
          "type": "heatmap",
          "xAxis": {
            "show": true
          },
          "xBucketNumber": null,
          "xBucketSize": null,
          "yAxis": {
            "decimals": null,
            "format": "none",
            "logBase": 1,
            "max": null,
            "min": null,
            "show": true,
            "splitFactor": null
          },
          "yBucketNumber": null,
          "yBucketSize": null
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Event distribution",
      "titleSize": "h6"
    },
    {
      "collapse": true,
      "height": 250,
      "panels": [
        {
          "columns": [],
          "datasource": "$postgresql",
          "fontSize": "100%",
          "id": 3,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": true
          },
          "span": 12,
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "SELECT\n    SUBSTRING(eventsnmp FOR POSITION(',' IN eventsnmp) - 1) AS trapOID,\n    COUNT(eventid) AS tally\nFROM\n    events\nWHERE\n    eventUEI = 'uei.opennms.org/generic/traps/EnterpriseDefault'\nand\n    $__timeFilter(eventtime)\nGROUP BY trapOID\nORDER BY tally DESC",
              "refId": "A"
            }
          ],
          "title": "Enterprise Default Events",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "SNMP events",
      "titleSize": "h6"
    },
    {
      "collapse": true,
      "height": 250,
      "panels": [
        {
          "columns": [],
          "datasource": "$postgresql",
          "fontSize": "100%",
          "id": 4,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 2,
            "desc": true
          },
          "span": 12,
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 0,
              "pattern": "Incidents",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "table",
              "rawSql": "SELECT\n    nodelabel AS \"Node\",\n    servicename AS \"Service\",\n    COUNT(e.serviceid) AS \"Incidents\"\nFROM node n\n    JOIN events e USING(nodeid)\n    JOIN service s USING(serviceid)\nWHERE\n    e.eventuei = 'uei.opennms.org/nodes/nodeLostService'\nAND\n    $__timeFilter(e.eventtime)\nGROUP BY\n    n.nodelabel,\n    s.servicename,\n    e.serviceid\nORDER BY\n  count(e.serviceid) DESC\nLIMIT 20",
              "refId": "A"
            }
          ],
          "title": "Node lost service",
          "transform": "table",
          "type": "table"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Node lost service",
      "titleSize": "h6"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [
    "opennms",
    "postgresql"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "OpenNMS Database",
          "value": "OpenNMS Database"
        },
        "hide": 0,
        "label": null,
        "name": "postgresql",
        "options": [],
        "query": "postgres",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-3h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "OpenNMS Event Maintenance",
  "version": 10
}