Grafana dashboard: Alarm
Description: test


{
  "__inputs": [
    {
      "name": "DS_ZAGREUS",
      "label": "zagreus",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.4.4"
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1648111479112,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "zones"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Province/Zone"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "towns"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "City/Town"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "sites"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Sites"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 8,
        "x": 0,
        "y": 0
      },
      "id": 8,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "text": {},
        "textMode": "value_and_name"
      },
      "pluginVersion": "8.4.4",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as zones\nFROM alarm_report\nWHERE status = 1\nAND province_zone IN ($zones)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as towns\nFROM alarm_report\nWHERE status = 1\nAND province_zone IN ($zones)\nAND city_town IN ($towns)",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(distinct site_id) as sites\nFROM alarm_report\nWHERE status = 1\nAND province_zone IN ($zones)\nAND city_town IN ($towns)\nAND site_name IN ($sites)",
          "refId": "C",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Number of Active Events",
      "type": "stat"
    },
    {
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "zones"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Province/Zone"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "towns"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "City/Town"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "sites"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Sites"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 8,
        "x": 8,
        "y": 0
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "text": {},
        "textMode": "value_and_name"
      },
      "pluginVersion": "8.4.4",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as zones\nFROM alarm_report\nWHERE alarm_label ILIKE '%com%' \nAND status = 1\nAND province_zone IN ($zones)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as towns\nFROM alarm_report\nWHERE alarm_label ILIKE '%com%' \nAND status = 1\nAND province_zone IN ($zones)\nAND city_town IN ($towns)",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as sites\nFROM alarm_report\nWHERE alarm_label ILIKE '%com%' \nAND status = 1\nAND province_zone IN ($zones)\nAND city_town IN ($towns)\nAND site_name IN ($sites)",
          "refId": "C",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Number of Active Comms Failures",
      "type": "stat"
    },
    {
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Level 1"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Level 2"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "light-yellow",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Level 3"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "semi-dark-orange",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Level 4"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-red",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 5,
        "w": 8,
        "x": 16,
        "y": 0
      },
      "id": 7,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "text": {},
        "textMode": "value_and_name"
      },
      "pluginVersion": "8.4.4",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as \"Level 1\"\nFROM alarm_report\nWHERE status = 1\nand severity = 1\nAND province_zone IN ($zones)\nAND city_town IN ($towns)\nAND site_name IN ($sites)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as \"Level 2\"\nFROM alarm_report\nWHERE status = 1\nand severity = 2\nAND province_zone IN ($zones)\nAND city_town IN ($towns)\nAND site_name IN ($sites)",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as \"Level 3\"\nFROM alarm_report\nWHERE status = 1\nand severity = 3\nAND province_zone IN ($zones)\nAND city_town IN ($towns)\nAND site_name IN ($sites)",
          "refId": "C",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT \ncount(site_id) as \"Level 4\"\nFROM alarm_report\nWHERE status = 1\nand severity = 4\nAND province_zone IN ($zones)\nAND city_town IN ($towns)\nAND site_name IN ($sites)",
          "refId": "D",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Active Alarms per Severity Level",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "province_zone"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Province/Zone"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "city_town"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "City/Town"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "site_name"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Site Name"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "site_id"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Site ID"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "alarm_number"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Alarm Number"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "alarm_label"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Alarm Label"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "time_set"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Time Set"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "time_cleared"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Time Cleared"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "duration_in_minutes"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Duration (min)"
              },
              {
                "id": "decimals",
                "value": 2
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "info"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Info"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "status"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Status"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "severity"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Severity"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 15,
        "w": 24,
        "x": 0,
        "y": 5
      },
      "id": 2,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.4.4",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_ZAGREUS}"
          },
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT * FROM alarm_report\nWHERE province_zone IN ($zones)\nAND city_town IN ($towns)\nAND site_name IN ($sites)\nAND status IN ($active)\nAND severity IN ($severity)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "event",
          "timeColumn": "start_time",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Alarm Report",
      "type": "table"
    }
  ],
  "refresh": "",
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "hide": 0,
        "includeAll": true,
        "label": "Province/Zone",
        "multi": true,
        "name": "zones",
        "options": [
          {
            "selected": true,
            "text": "All",
            "value": "$__all"
          },
          {
            "selected": false,
            "text": "North Eastern",
            "value": "North Eastern"
          },
          {
            "selected": false,
            "text": "New Installations",
            "value": "New Installations"
          }
        ],
        "query": "North Eastern, New Installations",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "current": {
          "selected": true,
          "text": [
            "Mount Kenya"
          ],
          "value": [
            "Mount Kenya"
          ]
        },
        "hide": 0,
        "includeAll": true,
        "label": "City/Town",
        "multi": true,
        "name": "towns",
        "options": [
          {
            "selected": false,
            "text": "All",
            "value": "$__all"
          },
          {
            "selected": false,
            "text": "Rift Valley",
            "value": "Rift Valley"
          },
          {
            "selected": true,
            "text": "Mount Kenya",
            "value": "Mount Kenya"
          }
        ],
        "query": "Rift Valley, Mount Kenya",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "current": {},
        "definition": "SELECT\nDISTINCT \"name\"\nFROM site_view",
        "hide": 0,
        "includeAll": true,
        "label": "Site Name",
        "multi": true,
        "name": "sites",
        "options": [],
        "query": "SELECT\nDISTINCT \"name\"\nFROM site_view",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query",
        "datasource": "${DS_ZAGREUS}"
      },
      {
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "hide": 0,
        "includeAll": true,
        "label": "Severity Level",
        "multi": true,
        "name": "severity",
        "options": [
          {
            "selected": true,
            "text": "All",
            "value": "$__all"
          },
          {
            "selected": false,
            "text": "1",
            "value": "1"
          },
          {
            "selected": false,
            "text": "2",
            "value": "2"
          },
          {
            "selected": false,
            "text": "3",
            "value": "3"
          },
          {
            "selected": false,
            "text": "4",
            "value": "4"
          }
        ],
        "query": "1,2,3,4",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "current": {
          "selected": true,
          "text": [
            "All"
          ],
          "value": [
            "$__all"
          ]
        },
        "hide": 0,
        "includeAll": true,
        "label": "Active",
        "multi": true,
        "name": "active",
        "options": [
          {
            "selected": true,
            "text": "All",
            "value": "$__all"
          },
          {
            "selected": false,
            "text": "0",
            "value": "0"
          },
          {
            "selected": false,
            "text": "1",
            "value": "1"
          }
        ],
        "query": "0,1",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Alarm",
  "uid": "hRGLmqEnz",
  "version": 13,
  "weekStart": "",
  "gnetId": 15984,
  "description": "test"
}