Grafana dashboard: OpenNMS Business Service Availability
Description: Display the availiability of Business Services from OpenNMS including drill down.

This dashboard displays the availability of Business Services from OpenNMS. It is based on the Business Service events stored in OpenNMS's PostgresSQL database. It includes a basic drill down for that.

# Configuration

Create a PostgreSQL datasource pointing to OpenNMS's database prior to importing this dashboard. The user need at least `SELECT` access to `alarms`, `events`, and `bsm_service`.

# Known limitations

Please note, that only Business Services with Business Service events in the selected time frame are displayed!

{
  "__inputs": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.2.3"
    },
    {
      "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": "Display the availiability of Business Services from OpenNMS including drill down.",
  "editable": true,
  "gnetId": 7888,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1536416618033,
  "links": [
    {
      "icon": "external link",
      "tags": [],
      "title": "OpenNMS",
      "tooltip": "OpenNMS Web Frontend",
      "type": "link",
      "url": "https://opennms/"
    },
    {
      "asDropdown": true,
      "icon": "external link",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "opennms"
      ],
      "title": "Other Dashboards",
      "type": "dashboards"
    }
  ],
  "panels": [
    {
      "columns": [],
      "datasource": "$datasource",
      "fontSize": "100%",
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 8,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": 1,
        "desc": false
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "BSM ID",
          "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,
          "mappingType": 1,
          "pattern": "bsmid",
          "thresholds": [],
          "type": "number",
          "unit": "none"
        },
        {
          "alias": "Availability",
          "colorMode": "cell",
          "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,
          "mappingType": 1,
          "pattern": "availability",
          "thresholds": [
            "0.97",
            "0.98"
          ],
          "type": "number",
          "unit": "percentunit"
        },
        {
          "alias": "Duration",
          "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,
          "mappingType": 1,
          "pattern": "duration",
          "thresholds": [],
          "type": "number",
          "unit": "dthms"
        },
        {
          "alias": "Business Service",
          "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,
          "link": true,
          "linkTooltip": "${__cell} details",
          "linkUrl": "dashboard/db/opennms-business-service?var-service=${__cell}",
          "mappingType": 1,
          "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",
          "rawSql": "SELECT\n    bsm_service.name,\n    availability,\n    duration\nFROM\n(\n    SELECT \n        bsmid,\n        (EXTRACT(epoch FROM interval) - EXTRACT(epoch FROM duration)) / EXTRACT(epoch FROM interval) AS availability,\n        duration\n    FROM\n    (\n        SELECT\n            bsmId,\n            SUM(duration) AS duration,\n            timestamp $__timeTo() - timestamp $__timeFrom() AS interval\n        FROM\n        (\n            SELECT \n                bsmId,\n                detected,\n                resolved,\n                resolved -  detected AS duration\n            FROM\n            (\n                SELECT \n                    SUBSTRING(COALESCE(detected_eventdescr, closed_description) FROM 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n                    COALESCE(detected_alarmid, closed_alarmid) AS alarmid,\n                    COALESCE(detected, $__timeFrom()) AS detected,\n                    COALESCE(resolved, $__timeTo()) AS resolved,\n                    COALESCE(resolved, $__timeTo()) - COALESCE(detected, $__timeFrom()) AS duration,\n                    COALESCE(detected_eventdescr, 'Started prior to' || $__timeFrom()) AS description,\n                    COALESCE(closed_description, 'Ongoing') AS Resolution\n                FROM\n                (\n                    (\n                        SELECT\n                            MIN(eventtime) AS detected,\n                            eventdescr AS detected_eventdescr,\n                            alarmid AS detected_alarmid\n                        FROM\n                            events\n                        WHERE\n                            eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n                        AND \n                            $__timeFilter(eventtime)\n                        GROUP BY \n                            alarmid, eventdescr\n                    ) AS detected\n                    FULL OUTER JOIN \n                    (\n                        SELECT\n                            MAX(eventtime) AS resolved,\n                            eventdescr AS closed_description,\n                            alarmid AS closed_alarmid\n                        FROM\n                            events\n                        WHERE\n                            eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n                        AND \n                            $__timeFilter(eventtime)\n                        GROUP BY\n                            alarmid, eventdescr\n                    ) AS closed\n                    ON (detected.detected_alarmid = closed.closed_alarmid)\n                ) AS outages\n            ) AS durations\n        ) AS xxx\n        GROUP BY\n            bsmid\n    ) AS duration\n) AS availability\nINNER JOIN bsm_service ON (bsm_service.id = availability.bsmid)\nWHERE\n  bsm_service.name IN ( $service)",
          "refId": "A"
        }
      ],
      "title": "Business Service Availability",
      "transform": "table",
      "type": "table"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 10
      },
      "id": 25,
      "panels": [
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 13,
            "w": 24,
            "x": 0,
            "y": 11
          },
          "id": 26,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 1,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Availability",
              "colorMode": "cell",
              "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,
              "mappingType": 1,
              "pattern": "availability",
              "thresholds": [
                "0.97",
                "0.98"
              ],
              "type": "number",
              "unit": "percentunit"
            },
            {
              "alias": "Duration",
              "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,
              "mappingType": 1,
              "pattern": "duration",
              "thresholds": [],
              "type": "number",
              "unit": "dthms"
            },
            {
              "alias": "Business Service",
              "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,
              "link": true,
              "linkTooltip": "${__cell} details",
              "linkUrl": "dashboard/db/opennms-business-service?var-service=${__cell}",
              "mappingType": 1,
              "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",
              "rawSql": "SELECT\n    bsm_service.name,\n    COALESCE(availability, 1.0) AS availability,\n    duration\nFROM\n(\n    SELECT \n        bsmid,\n        (EXTRACT(epoch FROM interval) - EXTRACT(epoch FROM duration)) / EXTRACT(epoch FROM interval) AS availability,\n        duration\n    FROM\n    (\n        SELECT\n            bsmId,\n            SUM(duration) AS duration,\n            timestamp $__timeTo() - timestamp $__timeFrom() AS interval\n        FROM\n        (\n            SELECT \n                bsmId,\n                detected,\n                resolved,\n                resolved -  detected AS duration\n            FROM\n            (\n                SELECT \n                    SUBSTRING(COALESCE(detected_eventdescr, closed_description) FROM 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n                    COALESCE(detected_alarmid, closed_alarmid) AS alarmid,\n                    COALESCE(detected, $__timeFrom()) AS detected,\n                    COALESCE(resolved, $__timeTo()) AS resolved,\n                    COALESCE(resolved, $__timeTo()) - COALESCE(detected, $__timeFrom()) AS duration,\n                    COALESCE(detected_eventdescr, 'Started prior to' || $__timeFrom()) AS description,\n                    COALESCE(closed_description, 'Ongoing') AS Resolution\n                FROM\n                (\n                    (\n                        SELECT\n                            MIN(eventtime) AS detected,\n                            eventdescr AS detected_eventdescr,\n                            alarmid AS detected_alarmid\n                        FROM\n                            events\n                        WHERE\n                            eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n                        AND \n                            $__timeFilter(eventtime)\n                        GROUP BY \n                            alarmid, eventdescr\n                    ) AS detected\n                    FULL OUTER JOIN \n                    (\n                        SELECT\n                            MAX(eventtime) AS resolved,\n                            eventdescr AS closed_description,\n                            alarmid AS closed_alarmid\n                        FROM\n                            events\n                        WHERE\n                            eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n                        AND \n                            $__timeFilter(eventtime)\n                        GROUP BY\n                            alarmid, eventdescr\n                    ) AS closed\n                    ON (detected.detected_alarmid = closed.closed_alarmid)\n                ) AS outages\n            ) AS durations\n        ) AS xxx\n        GROUP BY\n            bsmid\n    ) AS duration\n) AS availability\nRIGHT OUTER JOIN bsm_service ON (bsm_service.id = availability.bsmid)\n",
              "refId": "A"
            }
          ],
          "title": "Business Service Availability",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 10,
            "w": 11,
            "x": 0,
            "y": 24
          },
          "id": 21,
          "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": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Availability",
              "colorMode": "cell",
              "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,
              "mappingType": 1,
              "pattern": "availability",
              "thresholds": [
                "0.97",
                "0.98"
              ],
              "type": "number",
              "unit": "percentunit"
            },
            {
              "alias": "Duration",
              "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,
              "mappingType": 1,
              "pattern": "duration",
              "thresholds": [],
              "type": "number",
              "unit": "dthms"
            },
            {
              "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    bsmid,\n    (EXTRACT(epoch FROM interval) - EXTRACT(epoch FROM duration)) / EXTRACT(epoch FROM interval) AS availability,\n    duration\nFROM\n(\n    SELECT\n        bsmId,\n        SUM(duration) AS duration,\n        timestamp $__timeTo() - timestamp $__timeFrom() AS interval\n    FROM\n    (\n        SELECT \n            bsmId,\n            detected,\n            resolved,\n            resolved -  detected AS duration\n        FROM\n        (\n            SELECT \n                SUBSTRING(COALESCE(detected_eventdescr, closed_description) FROM 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n                COALESCE(detected_alarmid, closed_alarmid) AS alarmid,\n                COALESCE(detected, $__timeFrom()) AS detected,\n                COALESCE(resolved, $__timeTo()) AS resolved,\n                COALESCE(resolved, $__timeTo()) - COALESCE(detected, $__timeFrom()) AS duration,\n                COALESCE(detected_eventdescr, 'Started prior to' || $__timeFrom()) AS description,\n                COALESCE(closed_description, 'Ongoing') AS Resolution\n            FROM\n            (\n                (\n                    SELECT\n                        MIN(eventtime) AS detected,\n                        eventdescr AS detected_eventdescr,\n                        alarmid AS detected_alarmid\n                    FROM\n                        events\n                    WHERE\n                        eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n                    AND \n                        $__timeFilter(eventtime)\n                    GROUP BY \n                        alarmid, eventdescr\n                ) AS detected\n                FULL OUTER JOIN \n                (\n                    SELECT\n                        MAX(eventtime) AS resolved,\n                        eventdescr AS closed_description,\n                        alarmid AS closed_alarmid\n                    FROM\n                        events\n                    WHERE\n                        eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n                    AND \n                        $__timeFilter(eventtime)\n                    GROUP BY\n                        alarmid, eventdescr\n                ) AS closed\n                ON (detected.detected_alarmid = closed.closed_alarmid)\n            ) AS outages\n        ) AS durations\n    ) AS xxx\n    GROUP BY\n        bsmid\n) AS duration",
              "refId": "A"
            }
          ],
          "title": "Business Service Availability",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 10,
            "w": 13,
            "x": 11,
            "y": 24
          },
          "id": 23,
          "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": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "id",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "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,
              "link": true,
              "linkTooltip": "${__cell} details",
              "linkUrl": "dashboard/db/opennms-business-service?var-service=${__cell}",
              "mappingType": 1,
              "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",
              "rawSql": "SELECT\n    id,\n    name\nFROM \n    bsm_service",
              "refId": "A"
            }
          ],
          "title": "Business Services",
          "transform": "table",
          "type": "table"
        }
      ],
      "title": "Business Service Details",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 11
      },
      "id": 18,
      "panels": [
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 12,
            "w": 24,
            "x": 0,
            "y": 12
          },
          "id": 19,
          "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": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Cumulated outage duration",
              "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,
              "link": false,
              "mappingType": 1,
              "pattern": "duration",
              "thresholds": [
                "0"
              ],
              "type": "number",
              "unit": "dthms"
            },
            {
              "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  bsmId,\n  SUM(duration) AS duration,\n  timestamp $__timeTo() - timestamp $__timeFrom() AS interval\nFROM\n(\n    SELECT \n        bsmId,\n        detected,\n        resolved,\n        resolved -  detected AS duration\n    FROM\n    (\n        SELECT \n            SUBSTRING(COALESCE(detected_eventdescr, closed_description) FROM 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n            COALESCE(detected_alarmid, closed_alarmid) AS alarmid,\n            COALESCE(detected, $__timeFrom()) AS detected,\n            COALESCE(resolved, $__timeTo()) AS resolved,\n            COALESCE(resolved, $__timeTo()) - COALESCE(detected, $__timeFrom()) AS duration,\n            COALESCE(detected_eventdescr, 'Started prior to' || $__timeFrom()) AS description,\n            COALESCE(closed_description, 'Ongoing') AS Resolution\n        FROM\n        (\n            (\n                SELECT\n                    MIN(eventtime) AS detected,\n                    eventdescr AS detected_eventdescr,\n                    alarmid AS detected_alarmid\n                FROM\n                    events\n                WHERE\n                    eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n                AND \n                    $__timeFilter(eventtime)\n                GROUP BY \n                    alarmid, eventdescr\n            ) AS detected\n            FULL OUTER JOIN \n            (\n                SELECT\n                    MAX(eventtime) AS resolved,\n                    eventdescr AS closed_description,\n                    alarmid AS closed_alarmid\n                FROM\n                    events\n                WHERE\n                    eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n                AND \n                    $__timeFilter(eventtime)\n                GROUP BY\n                    alarmid, eventdescr\n            ) AS closed\n            ON (detected.detected_alarmid = closed.closed_alarmid)\n        ) AS outages\n    ) AS durations\n) AS xxx\nGROUP BY\n    bsmid\n",
              "refId": "A"
            }
          ],
          "title": "Business Service cumulated outages",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 12,
            "w": 24,
            "x": 0,
            "y": 24
          },
          "id": 20,
          "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": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Duration",
              "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,
              "link": false,
              "mappingType": 1,
              "pattern": "duration",
              "thresholds": [
                "0"
              ],
              "type": "number",
              "unit": "dthms"
            },
            {
              "alias": "Detected",
              "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,
              "mappingType": 1,
              "pattern": "detected",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "Resolved",
              "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,
              "mappingType": 1,
              "pattern": "resolved",
              "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    bsmId,\n    detected,\n    resolved,\n    detected -  resolved AS duration\nFROM\n(\n    SELECT \n        SUBSTRING(COALESCE(detected_eventdescr, closed_description) FROM 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n        COALESCE(detected_alarmid, closed_alarmid) AS alarmid,\n        COALESCE(detected, $__timeFrom()) AS detected,\n        COALESCE(resolved, $__timeTo()) AS resolved,\n        COALESCE(resolved, $__timeTo()) - COALESCE(detected, $__timeFrom()) AS duration,\n        COALESCE(detected_eventdescr, 'Started prior to' || $__timeFrom()) AS description,\n        COALESCE(closed_description, 'Ongoing') AS Resolution\n    FROM\n    (\n        (\n            SELECT\n                MIN(eventtime) AS detected,\n                eventdescr AS detected_eventdescr,\n                alarmid AS detected_alarmid\n            FROM\n                events\n            WHERE\n                eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n            AND \n                $__timeFilter(eventtime)\n            GROUP BY \n                alarmid, eventdescr\n        ) AS detected\n        FULL OUTER JOIN \n        (\n            SELECT\n                MAX(eventtime) AS resolved,\n                eventdescr AS closed_description,\n                alarmid AS closed_alarmid\n            FROM\n                events\n            WHERE\n                eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n            AND \n                $__timeFilter(eventtime)\n            GROUP BY\n                alarmid, eventdescr\n        ) AS closed\n        ON (detected.detected_alarmid = closed.closed_alarmid)\n    ) AS outages\n) AS durations\nORDER BY\n    detected\n",
              "refId": "A"
            }
          ],
          "title": "Business Service cumulated outages",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 36
          },
          "id": 4,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Alarm ID",
              "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,
              "mappingType": 1,
              "pattern": "alarmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Description",
              "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,
              "mappingType": 1,
              "pattern": "eventdescr",
              "preserveFormat": false,
              "sanitize": true,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "Detected",
              "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,
              "mappingType": 1,
              "pattern": "detected",
              "thresholds": [],
              "type": "date",
              "unit": "short"
            },
            {
              "alias": "Resolved",
              "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,
              "mappingType": 1,
              "pattern": "resolved",
              "thresholds": [],
              "type": "date",
              "unit": "short"
            },
            {
              "alias": "Resolution",
              "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,
              "mappingType": 1,
              "pattern": "resolution",
              "sanitize": true,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "Duration",
              "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,
              "mappingType": 1,
              "pattern": "duration",
              "thresholds": [
                "24",
                "100000"
              ],
              "type": "number",
              "unit": "dthms"
            },
            {
              "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  bsmid, alarmid, MIN(detected) AS detected, resolved, MAX(duration), resolution\nFROM\n  (\n    SELECT \n      bsmId, alarmid, detected, COALESCE(resolved, $__timeTo()) AS resolved, COALESCE(resolved, $__timeTo()) - detected AS duration, eventdescr, COALESCE(closed_description, 'Ongoing') AS Resolution\n    FROM\n      (\n        (\n          SELECT\n            substring(eventdescr from 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n            eventtime AS detected,\n            eventdescr,\n            alarmid\n          FROM\n            events\n          WHERE\n            eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n          AND \n            $__timeFilter(eventtime)\n        ) AS detected\n        LEFT OUTER JOIN \n        (\n          SELECT\n            eventtime AS resolved,\n            eventdescr AS closed_description,\n            alarmid AS closed_alarmid\n          FROM\n            events\n          WHERE\n            eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n          AND \n            $__timeFilter(eventtime)\n        ) AS closed ON (detected.alarmid = closed.closed_alarmid)\n      ) AS outages\n  ) AS outages\nGROUP BY\n  bsmid, alarmid, resolved, resolution\nORDER BY\n  bsmid, detected\n\n",
              "refId": "A"
            }
          ],
          "title": "Business Service outages",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 46
          },
          "id": 10,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 1,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "date"
            },
            {
              "alias": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Alarm ID",
              "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,
              "mappingType": 1,
              "pattern": "alarmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Description",
              "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,
              "mappingType": 1,
              "pattern": "eventdescr",
              "preserveFormat": false,
              "sanitize": true,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "Detected",
              "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,
              "mappingType": 1,
              "pattern": "detected",
              "thresholds": [],
              "type": "date",
              "unit": "short"
            },
            {
              "alias": "Resolved",
              "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,
              "mappingType": 1,
              "pattern": "resolved",
              "thresholds": [],
              "type": "date",
              "unit": "short"
            },
            {
              "alias": "Resolution",
              "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,
              "mappingType": 1,
              "pattern": "resolution",
              "sanitize": true,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "Duration",
              "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,
              "mappingType": 1,
              "pattern": "duration",
              "thresholds": [
                "24",
                "100000"
              ],
              "type": "number",
              "unit": "dthms"
            },
            {
              "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(COALESCE(detected_eventdescr, closed_description) FROM 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n    COALESCE(detected_alarmid, closed_alarmid) AS alarmid,\n    COALESCE(detected, $__timeFrom()) AS detected,\n    COALESCE(resolved, $__timeTo()) AS resolved,\n    COALESCE(resolved, $__timeTo()) - COALESCE(detected, $__timeFrom()) AS duration,\n    COALESCE(detected_eventdescr, 'Started prior to' || $__timeFrom()) AS description,\n    COALESCE(closed_description, 'Ongoing') AS Resolution\nFROM\n(\n    (\n        SELECT\n            MIN(eventtime) AS detected,\n            eventdescr AS detected_eventdescr,\n            alarmid AS detected_alarmid\n        FROM\n            events\n        WHERE\n            eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n        AND \n            $__timeFilter(eventtime)\n        GROUP BY \n            alarmid, eventdescr\n    ) AS detected\n    FULL OUTER JOIN \n    (\n        SELECT\n            MAX(eventtime) AS resolved,\n            eventdescr AS closed_description,\n            alarmid AS closed_alarmid\n        FROM\n            events\n        WHERE\n            eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n        AND \n            $__timeFilter(eventtime)\n        GROUP BY\n            alarmid, eventdescr\n    ) AS closed\n    ON (detected.detected_alarmid = closed.closed_alarmid)\n) AS outages\nORDER BY\n    bsmid, detected\n",
              "refId": "A"
            }
          ],
          "title": "Business Service outages",
          "transform": "table",
          "type": "table"
        }
      ],
      "title": "Business Service Outages",
      "type": "row"
    },
    {
      "collapsed": true,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 12
      },
      "id": 13,
      "panels": [
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 12,
            "w": 24,
            "x": 0,
            "y": 53
          },
          "id": 15,
          "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": "",
              "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,
              "mappingType": 1,
              "pattern": "detected",
              "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,
              "mappingType": 1,
              "pattern": "resolved",
              "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": 0,
              "mappingType": 1,
              "pattern": "/.*alarmid$/",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "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    *\nFROM\n(\n    SELECT\n        MIN(eventtime) AS detected,\n        eventdescr,\n        alarmid AS detected_alarmid\n    FROM\n        events\n    WHERE\n        eventuei LIKE 'uei.opennms.org/bsm/serviceProblem'\n    AND \n        $__timeFilter(eventtime)\n    GROUP BY \n        alarmid, eventdescr\n) AS detected\nFULL OUTER JOIN \n(\n    SELECT\n        MAX(eventtime) AS resolved,\n        eventdescr AS closed_description,\n        alarmid AS closed_alarmid\n    FROM\n        events\n    WHERE\n        eventuei LIKE 'uei.opennms.org/bsm/serviceProblemResolved'\n    AND \n        $__timeFilter(eventtime)\n    GROUP BY\n        alarmid, eventdescr\n) AS closed\nON (detected.detected_alarmid = closed.closed_alarmid)\n\n\n",
              "refId": "A"
            }
          ],
          "title": "Business Service Events (combined)",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 13,
            "w": 12,
            "x": 0,
            "y": 65
          },
          "id": 2,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": true
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "eventtime",
              "type": "date"
            },
            {
              "alias": "Alarm ID",
              "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,
              "mappingType": 1,
              "pattern": "alarmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Description",
              "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,
              "mappingType": 1,
              "pattern": "eventdescr",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "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(eventdescr from 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n  eventuei,\n  MIN(eventtime) AS eventtime,\n  eventdescr,\n  alarmid\nFROM\n  events\nWHERE\n  eventuei like 'uei.opennms.org/bsm/serviceProblem%'\nAND \n  $__timeFilter(eventtime)\nGROUP BY\n  alarmid, eventdescr, eventuei\nORDER BY\n  eventtime\n\n--  EXTRACT(DAYS FROM age(now(), bsmAlarm.lasteventtime)) || 'd ' || EXTRACT(HOURS FROM age(now(), bsmAlarm.lasteventtime)) || 'h ' || EXTRACT(MINUTES FROM age(now(), bsmAlarm.lasteventtime)) || 'm ' || ROUND(EXTRACT(SECONDS FROM age(now(), bsmAlarm.lasteventtime))::NUMERIC,0) || 's' AS duration\n--    substring(reductionkey from '[0-9]+$')::INTEGER AS bsmId,\n",
              "refId": "A"
            }
          ],
          "title": "Business Service events (Problem detected)",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 13,
            "w": 12,
            "x": 12,
            "y": 65
          },
          "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": "eventtime",
              "type": "date"
            },
            {
              "alias": "Alarm ID",
              "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,
              "mappingType": 1,
              "pattern": "alarmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Description",
              "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,
              "mappingType": 1,
              "pattern": "eventdescr",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "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(eventdescr from 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n  eventuei,\n  MAX(eventtime) AS eventtime,\n  eventdescr,\n  alarmid\nFROM\n  events\nWHERE\n  eventuei like 'uei.opennms.org/bsm/serviceProblemResolved'\nAND \n  $__timeFilter(eventtime)\nGROUP BY\n  alarmid, eventdescr, eventuei\nORDER BY\n  eventtime\n\n--  EXTRACT(DAYS FROM age(now(), bsmAlarm.lasteventtime)) || 'd ' || EXTRACT(HOURS FROM age(now(), bsmAlarm.lasteventtime)) || 'h ' || EXTRACT(MINUTES FROM age(now(), bsmAlarm.lasteventtime)) || 'm ' || ROUND(EXTRACT(SECONDS FROM age(now(), bsmAlarm.lasteventtime))::NUMERIC,0) || 's' AS duration\n--    substring(reductionkey from '[0-9]+$')::INTEGER AS bsmId,\n",
              "refId": "A"
            }
          ],
          "title": "Business Service events (Problem resolved)",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 11,
            "w": 24,
            "x": 0,
            "y": 78
          },
          "id": 16,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": true
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "eventtime",
              "type": "date"
            },
            {
              "alias": "Alarm ID",
              "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,
              "mappingType": 1,
              "pattern": "alarmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "alias": "Description",
              "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,
              "mappingType": 1,
              "pattern": "eventdescr",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "BSM ID",
              "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,
              "mappingType": 1,
              "pattern": "bsmid",
              "thresholds": [],
              "type": "number",
              "unit": "none"
            },
            {
              "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(eventdescr from 'businessServiceId=\"([0-9]+)\"')::INTEGER AS bsmId,\n  eventuei,\n  eventtime,\n  eventdescr,\n  alarmid\nFROM\n  events\nWHERE\n  eventuei like 'uei.opennms.org/bsm/serviceProblem%'\nAND \n  $__timeFilter(eventtime)\nORDER BY\n  eventtime\n",
              "refId": "A"
            }
          ],
          "title": "Business Service events",
          "transform": "table",
          "type": "table"
        }
      ],
      "title": "Business Service Events",
      "type": "row"
    }
  ],
  "refresh": false,
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "opennms"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "OpenNMS Database",
          "value": "OpenNMS Database"
        },
        "hide": 0,
        "label": null,
        "name": "datasource",
        "options": [],
        "query": "postgres",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$datasource",
        "hide": 0,
        "includeAll": true,
        "label": "Business Services",
        "multi": true,
        "name": "service",
        "options": [],
        "query": "SELECT name from bsm_service",
        "refresh": 1,
        "regex": "",
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "2018-08-18T14:33:56.308Z",
    "to": "2018-08-29T02:03:56.000Z"
  },
  "timepicker": {
    "refresh_intervals": [
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "OpenNMS Business Service Availability",
  "uid": "ECW76l2iz",
  "version": 16
}