Grafana dashboard: OpenNMS Outage Dashboard
Description: Dashboard which shows current outages from Nodes, Interfaces and Services in selected Surveillance Categories.

For users, until Horizon 21.1.0 these views need to be added manually into the database. If you have Horizon 24.0.0+ these views come preinstalled with the default database scheme.

* [node_alarms_view.sql](https://gist.github.com/indigo423/7926424df459cd3fa1ace504856567c8)
* [node_ip_services_view.sql](https://gist.github.com/indigo423/e327753c950e9a9a3097bc0ef0cbc4b3)
* [node_outages_view.sql](https://gist.github.com/indigo423/306758499244dbda0792998c339d0c38)
* [node_categories_view.sql](https://gist.github.com/indigo423/49301465e65367b2ac38b9b8fc21871c)

Details and discussions please in our [OpenNMS public wiki](https://wiki.opennms.org/wiki/Proposals/Outage_Visualization) or [Chat](https://chat.opennms.org/opennms-discuss)

Report source available in our [Grafana Dashboard GitHub Repository](https://github.com/opennms-forge/grafana-dashboards).

{
  "__inputs": [
    {
      "name": "DS_OPENNMS_PSQL",
      "label": "OpenNMS PSQL",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.3.1"
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": "5.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Dashboard which shows current outages from Nodes, Interfaces and Services in selected Surveillance Categories.",
  "editable": true,
  "gnetId": 5921,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1540202151981,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 15,
      "panels": [],
      "repeat": null,
      "title": "Outstanding Business Service Alarms",
      "type": "row"
    },
    {
      "columns": [],
      "datasource": "${DS_OPENNMS_PSQL}",
      "fontSize": "100%",
      "gridPos": {
        "h": 5,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 16,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Last Event Time",
          "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": 2,
          "pattern": "lasteventtime",
          "thresholds": [],
          "type": "date",
          "unit": "short"
        },
        {
          "alias": "Affected since first event time",
          "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": 2,
          "pattern": "duration",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "First Event Time",
          "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": 2,
          "pattern": "firsteventtime",
          "thresholds": [],
          "type": "date",
          "unit": "short"
        },
        {
          "alias": "Business Service Name",
          "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": 2,
          "pattern": "name",
          "thresholds": [],
          "type": "string",
          "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",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  bsm_service.name,\n  bsmAlarm.firsteventtime,\n  bsmAlarm.lasteventtime,\n  EXTRACT(DAYS FROM age(now(), bsmAlarm.firsteventtime)) || 'd ' || EXTRACT(HOURS FROM age(now(), bsmAlarm.firsteventtime)) || 'h ' || EXTRACT(MINUTES FROM age(now(), bsmAlarm.firsteventtime)) || 'm ' || ROUND(EXTRACT(SECONDS FROM age(now(), bsmAlarm.lasteventtime))::NUMERIC,0) || 's' AS duration\nFROM\n  bsm_service\nJOIN\n  (SELECT\n    substring(reductionkey from '[0-9]+$')::INTEGER AS bsmId,\n    alarms.firsteventtime,\n    alarms.lasteventtime\n  FROM\n    alarms\n  WHERE\n    eventuei = 'uei.opennms.org/bsm/serviceProblem') AS bsmAlarm\nON\n   bsmAlarm.bsmId = bsm_service.id\nORDER BY\n  bsmAlarm.lasteventtime DESC,\n  duration DESC,\n  bsm_service.name ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Node Alarms in Category: $category",
      "transform": "table",
      "type": "table"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "id": 13,
      "panels": [],
      "repeat": null,
      "title": "Outstanding Alarms",
      "type": "row"
    },
    {
      "columns": [],
      "datasource": "${DS_OPENNMS_PSQL}",
      "fontSize": "100%",
      "gridPos": {
        "h": 6,
        "w": 7,
        "x": 0,
        "y": 7
      },
      "id": 9,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Location",
          "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": 2,
          "pattern": "location",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Node Label",
          "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": 2,
          "pattern": "nodelabel",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Last Event Time",
          "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": 2,
          "pattern": "lasteventtime",
          "thresholds": [],
          "type": "date",
          "unit": "short"
        },
        {
          "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": 2,
          "pattern": "duration_raw",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Affected since",
          "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": 2,
          "pattern": "duration",
          "thresholds": [],
          "type": "string",
          "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",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  node_alarms.location,\n  node_alarms.nodelabel,\n  node_alarms.lasteventtime,\n  to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime AS duration_raw,\n  EXTRACT(DAYS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'd ' || EXTRACT(HOURS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'h ' || EXTRACT(MINUTES FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'm ' || ROUND(EXTRACT(SECONDS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime)::NUMERIC,0) || 's' AS duration\nFROM\n  node_alarms\nWHERE\n  node_alarms.acknowledged = FALSE AND\n  node_alarms.eventuei like 'uei.opennms.org/nodes/nodeDown' AND\n  node_alarms.location IN ($location) AND\n  node_alarms.categoryname IN ($category) AND\n  node_alarms.max_alarm_severity_unack = '6'\nGROUP BY\n  node_alarms.location,\n  node_alarms.nodelabel,\n  node_alarms.nodeid,\n  node_alarms.firsteventtime,\n  node_alarms.lasteventtime\nORDER BY\n  duration_raw DESC,\n  node_alarms.location ASC,\n  node_alarms.nodelabel ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Node Alarms in Category: $category",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_OPENNMS_PSQL}",
      "fontSize": "100%",
      "gridPos": {
        "h": 6,
        "w": 7,
        "x": 7,
        "y": 7
      },
      "id": 10,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Location",
          "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": 2,
          "pattern": "location",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Node Label",
          "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": 2,
          "pattern": "nodelabel",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "First Event Time",
          "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": 2,
          "pattern": "firsteventtime",
          "thresholds": [],
          "type": "date",
          "unit": "short"
        },
        {
          "alias": "Last Event Time",
          "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": 2,
          "pattern": "lasteventtime",
          "thresholds": [],
          "type": "date",
          "unit": "short"
        },
        {
          "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": 2,
          "pattern": "duration_raw",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Affected since",
          "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": 2,
          "pattern": "duration",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "IP Address",
          "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": 2,
          "pattern": "ipaddr",
          "thresholds": [],
          "type": "string",
          "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",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  node_alarms.location,\n  node_alarms.nodelabel,\n  node_alarms.ipaddr,\n  node_alarms.lasteventtime,\n  to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime AS duration_raw,\n  EXTRACT(DAYS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'd ' || EXTRACT(HOURS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'h ' || EXTRACT(MINUTES FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'm ' || ROUND(EXTRACT(SECONDS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime)::NUMERIC,0) || 's' AS duration\nFROM\n  node_alarms\nWHERE\n  node_alarms.acknowledged = FALSE AND\n  node_alarms.eventuei like 'uei.opennms.org/nodes/interfaceDown' AND\n  node_alarms.location IN ($location) AND\n  node_alarms.categoryname IN ($category) AND\n  node_alarms.max_alarm_severity_unack = '5'\nGROUP BY\n  node_alarms.location,\n  node_alarms.nodeid,\n  node_alarms.nodelabel,\n  node_alarms.ipaddr,\n  node_alarms.firsteventtime,\n  node_alarms.lasteventtime\nORDER BY\n  duration_raw DESC,\n  node_alarms.location ASC,\n  node_alarms.nodelabel ASC,\n  node_alarms.ipaddr ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Interface Alarms in Category: $category",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_OPENNMS_PSQL}",
      "fontSize": "100%",
      "gridPos": {
        "h": 6,
        "w": 10,
        "x": 14,
        "y": 7
      },
      "id": 11,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Location",
          "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": 2,
          "pattern": "location",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Node Label",
          "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": 2,
          "pattern": "nodelabel",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Last Event",
          "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": 2,
          "pattern": "lasteventtime",
          "thresholds": [],
          "type": "date",
          "unit": "short"
        },
        {
          "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": 2,
          "pattern": "duration_raw",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Affected since",
          "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": 2,
          "pattern": "duration",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "IP Address",
          "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": 2,
          "pattern": "ipaddr",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Service Name",
          "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": 2,
          "pattern": "servicename",
          "thresholds": [],
          "type": "string",
          "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",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  node_alarms.location,\n  node_alarms.nodelabel,\n  node_alarms.ipaddr,\n  node_alarms.servicename,\n  node_alarms.lasteventtime,\n  to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime AS duration_raw,\n  EXTRACT(DAYS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'd ' || EXTRACT(HOURS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'h ' || EXTRACT(MINUTES FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime) || 'm ' || ROUND(EXTRACT(SECONDS FROM to_timestamp($__unixEpochTo()) - node_alarms.firsteventtime)::NUMERIC,0) || 's' AS duration\nFROM\n  node_alarms\nWHERE\n  node_alarms.acknowledged = FALSE AND\n  node_alarms.eventuei like 'uei.opennms.org/nodes/nodeLostService' AND\n  node_alarms.location IN ($location) AND\n  node_alarms.categoryname IN ($category) AND\n  node_alarms.max_alarm_severity_unack = '5'\nGROUP BY\n  node_alarms.location,\n  node_alarms.nodeid,\n  node_alarms.nodelabel,\n  node_alarms.ipaddr,\n  node_alarms.servicename,\n  node_alarms.firsteventtime,\n  node_alarms.lasteventtime\nORDER BY\n  duration_raw DESC,\n  node_alarms.location ASC,\n  node_alarms.nodelabel ASC,\n  node_alarms.ipaddr ASC,\n  node_alarms.servicename ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Service Alarms in Category: $category",
      "transform": "table",
      "type": "table"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 13
      },
      "id": 2,
      "panels": [],
      "repeat": null,
      "title": "Current Outages",
      "type": "row"
    },
    {
      "columns": [],
      "datasource": "${DS_OPENNMS_PSQL}",
      "description": "Availability for Nodes with outages in a selected Surveillance Category",
      "fontSize": "100%",
      "gridPos": {
        "h": 6,
        "w": 7,
        "x": 0,
        "y": 14
      },
      "id": 5,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": 4,
        "desc": false
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Node Label",
          "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": 2,
          "pattern": "nodelabel",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Outage since",
          "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": 2,
          "pattern": "duration",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Availability in %",
          "colorMode": "value",
          "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": 3,
          "pattern": "availability",
          "thresholds": [
            "70",
            "90"
          ],
          "type": "number",
          "unit": "percent"
        },
        {
          "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": 2,
          "pattern": "duration_raw",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Location",
          "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": 2,
          "pattern": "location",
          "thresholds": [],
          "type": "string",
          "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",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  n.location,\n  n.nodelabel,\n  100.0 - 100.0/(EXTRACT(EPOCH FROM to_timestamp($__unixEpochTo())) - EXTRACT(EPOCH FROM to_timestamp($__unixEpochFrom()))) * EXTRACT(EPOCH FROM (to_timestamp($__unixEpochTo()) - GREATEST(n.iflostservice, to_timestamp($__unixEpochFrom())))) AS availability,\n  to_timestamp($__unixEpochTo()) - n.iflostservice AS duration_raw,\n  EXTRACT(DAYS FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'd ' || EXTRACT(HOURS FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'h ' || EXTRACT(MINUTES FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'm ' || ROUND(EXTRACT(SECONDS FROM to_timestamp($__unixEpochTo()) - n.iflostservice)::NUMERIC,0) || 's' AS duration\nFROM\n  node_outages n\nJOIN\n  node_outage_status nos\nON\n  n.nodeid = nos.nodeid\nWHERE\n  n.resolved = FALSE AND\n  n.svclosteventuei = 'uei.opennms.org/nodes/nodeDown' AND\n  nos.max_outage_severity = '6' AND\n  n.categoryname IN ($category) AND\n  n.location IN ($location)\nGROUP BY\n  n.location,\n  n.nodelabel,\n  n.eventseverity,\n  n.iflostservice\nORDER BY\n  duration_raw DESC,\n  availability ASC,\n  n.location ASC,\n  n.nodelabel ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Nodes in Category: $category",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_OPENNMS_PSQL}",
      "description": "Availability for Interfaces with outages in a selected Surveillance Category",
      "fontSize": "100%",
      "gridPos": {
        "h": 6,
        "w": 7,
        "x": 7,
        "y": 14
      },
      "id": 6,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": 4,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Node Label",
          "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": 2,
          "pattern": "nodelabel",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Outage since",
          "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": 2,
          "pattern": "duration",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Availability in %",
          "colorMode": "value",
          "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": 3,
          "pattern": "availability",
          "thresholds": [
            "70",
            "90"
          ],
          "type": "number",
          "unit": "percent"
        },
        {
          "alias": "IP Address",
          "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": 2,
          "pattern": "ipaddr",
          "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)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "pattern": "duration_raw",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Location",
          "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": 2,
          "pattern": "location",
          "thresholds": [],
          "type": "string",
          "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",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  n.location,\n  n.nodelabel,\n  n.ipaddr,\n  100.0 - 100.0/(EXTRACT(EPOCH FROM to_timestamp($__unixEpochTo())) - EXTRACT(EPOCH FROM to_timestamp($__unixEpochFrom()))) * EXTRACT(EPOCH FROM (to_timestamp($__unixEpochTo()) - GREATEST(n.iflostservice, to_timestamp($__unixEpochFrom())))) AS availability,\n  to_timestamp($__unixEpochTo()) - n.iflostservice AS duration_raw,\n  EXTRACT(DAYS FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'd ' || EXTRACT(HOURS FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'h ' || EXTRACT(MINUTES FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'm ' || ROUND(EXTRACT(SECONDS FROM to_timestamp($__unixEpochTo()) - n.iflostservice)::NUMERIC,0) || 's' AS duration\nFROM\n  node_outages n\nJOIN\n  node_outage_status nos\nON\n  n.nodeid = nos.nodeid\nWHERE\n  n.resolved = FALSE AND\n  n.svclosteventuei = 'uei.opennms.org/nodes/interfaceDown' AND\n  nos.max_outage_severity = '5' AND\n  n.categoryname IN ($category) AND\n  n.location IN ($location)\nGROUP BY\n  n.location,\n  n.nodelabel,\n  n.iflostservice,\n  n.ipaddr,\n  n.eventseverity,\n  n.svclosteventuei\nORDER BY\n  duration_raw DESC,\n  availability ASC,\n  n.location ASC,\n  n.nodelabel ASC,\n  n.ipaddr ASC\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Node Interfaces in Category: $category",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_OPENNMS_PSQL}",
      "description": "Availability for Services with outages in a selected Surveillance Category",
      "fontSize": "100%",
      "gridPos": {
        "h": 6,
        "w": 10,
        "x": 14,
        "y": 14
      },
      "id": 7,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": 4,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Node Label",
          "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": 2,
          "pattern": "nodelabel",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Outage since",
          "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": 2,
          "pattern": "duration",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Availability in %",
          "colorMode": "value",
          "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": 3,
          "pattern": "availability",
          "thresholds": [
            "70",
            "90"
          ],
          "type": "number",
          "unit": "percent"
        },
        {
          "alias": "IP Address",
          "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": 2,
          "pattern": "ipaddr",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        },
        {
          "alias": "Service Name",
          "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": 2,
          "pattern": "servicename",
          "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)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "pattern": "duration_raw",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Location",
          "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": 2,
          "pattern": "location",
          "thresholds": [],
          "type": "string",
          "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",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  n.location,\n  n.nodelabel,\n  n.ipaddr,\n  n.servicename,\n  100.0 - 100.0/(EXTRACT(EPOCH FROM to_timestamp($__unixEpochTo())) - EXTRACT(EPOCH FROM to_timestamp($__unixEpochFrom()))) * EXTRACT(EPOCH FROM (to_timestamp($__unixEpochTo()) - GREATEST(n.iflostservice, to_timestamp($__unixEpochFrom())))) AS availability,\n  to_timestamp($__unixEpochTo()) - n.iflostservice AS duration_raw,\n  EXTRACT(DAYS FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'd ' || EXTRACT(HOURS FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'h ' || EXTRACT(MINUTES FROM to_timestamp($__unixEpochTo()) - n.iflostservice) || 'm ' || ROUND(EXTRACT(SECONDS FROM to_timestamp($__unixEpochTo()) - n.iflostservice)::NUMERIC,0) || 's' AS duration\nFROM\n  node_outages n\nJOIN\n  node_outage_status nos\nON\n  n.nodeid = nos.nodeid\nWHERE\n  n.resolved = FALSE AND\n  n.svclosteventuei = 'uei.opennms.org/nodes/nodeLostService' AND\n  nos.max_outage_severity = '5' AND\n  n.categoryname IN ($category) AND\n  n.location IN ($location)\nGROUP BY\n  n.location,\n  n.nodelabel,\n  n.iflostservice,\n  n.ipaddr,\n  n.eventseverity,\n  n.servicename\nORDER BY\n  duration_raw DESC,\n  availability ASC,\n  n.location ASC,\n  n.nodelabel ASC,\n  n.ipaddr ASC,\n  n.servicename ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Node Services in Category: $category",
      "transform": "table",
      "type": "table"
    }
  ],
  "refresh": "10s",
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "opennms"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_OPENNMS_PSQL}",
        "hide": 0,
        "includeAll": true,
        "label": "Monitoring Location",
        "multi": true,
        "name": "location",
        "options": [],
        "query": "SELECT DISTINCT(n.location) FROM node n ORDER BY location ASC",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_OPENNMS_PSQL}",
        "hide": 0,
        "includeAll": true,
        "label": "Surveillance Category",
        "multi": true,
        "name": "category",
        "options": [],
        "query": "SELECT 'no category'::TEXT as categoryname UNION SELECT categoryname FROM categories ORDER BY categoryname",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "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": "OpenNMS Outage Dashboard",
  "uid": "rEAWRPGmz",
  "version": 4
}