Grafana dashboard: HEPIC TOP Stats

http://hepic.tel

{
  "__inputs": [
    {
      "name": "DS_CLICKHOUSE",
      "label": "ClickHouse",
      "description": "",
      "type": "datasource",
      "pluginId": "vertamedia-clickhouse-datasource",
      "pluginName": "ClickHouse"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.2.5"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "vertamedia-clickhouse-datasource",
      "name": "ClickHouse",
      "version": "1.9.5"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 11800,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_CLICKHOUSE}",
      "gridPos": {
        "h": 4,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 4,
      "links": [],
      "options": {
        "fieldOptions": {
          "calcs": [
            "sum"
          ],
          "defaults": {
            "max": 999,
            "min": 0,
            "title": "$__cell_2 BAD"
          },
          "mappings": [],
          "override": {},
          "thresholds": [
            {
              "color": "green",
              "index": 0,
              "value": null
            },
            {
              "color": "yellow",
              "index": 1,
              "value": 100
            },
            {
              "color": "red",
              "index": 2,
              "value": 200
            }
          ],
          "values": true
        },
        "orientation": "horizontal",
        "showThresholdLabels": false,
        "showThresholdMarkers": false
      },
      "pluginVersion": "6.2.5",
      "targets": [
        {
          "database": "hepic_data",
          "dateColDataType": "",
          "dateLoading": false,
          "dateTimeColDataType": "record_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT cnt, st, source_ip FROM ( \n    SELECT count(*) as cnt, 'Bad' as st, source_ip FROM $table WHERE $timeFilter AND status = 9 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n    UNION ALL\n    SELECT count(*) as cnt, 'Bad' as st, source_ip FROM $table WHERE $timeFilter AND status = 8 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n    UNION ALL\n    SELECT count(*) as cnt, 'Bad' as st, source_ip FROM $table WHERE $timeFilter AND status = 13 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n) ORDER BY cnt DESC LIMIT 5",
          "rawQuery": "SELECT cnt, st, source_ip FROM (      SELECT count(*) as cnt, 'Bad' as st, source_ip FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582337358) AND status = 9 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10     UNION ALL     SELECT count(*) as cnt, 'Bad' as st, source_ip FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582337358) AND status = 8 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10     UNION ALL     SELECT count(*) as cnt, 'Bad' as st, source_ip FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582337358) AND status = 13 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10 ) ORDER BY cnt DESC LIMIT 5",
          "refId": "A",
          "round": "0s",
          "table": "sip_transaction_call",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP Failing IPs",
      "type": "gauge"
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE}",
      "fontSize": "100%",
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 4
      },
      "id": 5,
      "links": [],
      "options": {},
      "pageSize": null,
      "pluginVersion": "6.2.5",
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Status",
          "colorMode": "row",
          "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": false,
          "mappingType": 1,
          "pattern": "st",
          "rangeMaps": [],
          "thresholds": [
            ""
          ],
          "type": "string",
          "unit": "short",
          "valueMaps": []
        },
        {
          "alias": "",
          "colorMode": "row",
          "colors": [
            "#FF9830",
            "#C4162A",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 0,
          "mappingType": 1,
          "pattern": "cnt",
          "thresholds": [
            "5"
          ],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "hepic_data",
          "dateColDataType": "",
          "dateLoading": false,
          "dateTimeColDataType": "record_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT source_ip, st, cnt FROM ( \n    SELECT count(*) as cnt, 'User Failure' as st, source_ip FROM $table WHERE $timeFilter AND status = 8 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n    UNION ALL\n    SELECT count(*) as cnt, 'Hard Failure' as st, source_ip FROM $table WHERE $timeFilter AND status = 9 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n    UNION ALL\n    SELECT count(*) as cnt, 'Bad Termination' as st, source_ip FROM $table WHERE $timeFilter AND status = 13 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n) ORDER BY cnt DESC LIMIT 10",
          "rawQuery": "SELECT source_ip, st, cnt FROM (      SELECT count(*) as cnt, 'User Failure' as st, source_ip FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582614761) AND status = 8 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10     UNION ALL     SELECT count(*) as cnt, 'Hard Failure' as st, source_ip FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582614761) AND status = 9 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10     UNION ALL     SELECT count(*) as cnt, 'Bad Termination' as st, source_ip FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582614761) AND status = 13 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10 ) ORDER BY cnt DESC LIMIT 10",
          "refId": "A",
          "round": "0s",
          "table": "sip_transaction_call",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 10 Union ALL",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE}",
      "fontSize": "100%",
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 4
      },
      "id": 3,
      "links": [],
      "options": {},
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Counter",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "link": false,
          "pattern": "cnt",
          "type": "number",
          "unit": "none"
        },
        {
          "alias": "Status",
          "colorMode": "row",
          "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": false,
          "mappingType": 1,
          "pattern": "st",
          "preserveFormat": false,
          "rangeMaps": [],
          "sanitize": false,
          "thresholds": [
            "Bad"
          ],
          "type": "string",
          "unit": "short",
          "valueMaps": []
        },
        {
          "alias": "Bad",
          "colorMode": "row",
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "#C4162A",
            "rgba(245, 54, 54, 0.9)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 0,
          "mappingType": 1,
          "pattern": "state",
          "thresholds": [
            "1"
          ],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "hepic_data",
          "dateColDataType": "",
          "dateLoading": false,
          "dateTimeColDataType": "record_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT source_ip, st, state, cnt FROM ( \n    SELECT count(*) as cnt, 'Finished' as st, source_ip, 0 as state FROM $table WHERE $timeFilter AND status = 10 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n    UNION ALL\n    SELECT count(*) as cnt, 'Bad' as st, source_ip, 1 as state FROM $table WHERE $timeFilter AND status = 8 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n    UNION ALL\n    SELECT count(*) as cnt, 'Bad' as st, source_ip, 1 as state FROM $table WHERE $timeFilter AND status = 9 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10\n) ORDER BY cnt DESC LIMIT 10",
          "rawQuery": "SELECT source_ip, st, state, cnt FROM (      SELECT count(*) as cnt, 'Finished' as st, source_ip, 0 as state FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582614761) AND status = 10 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10     UNION ALL     SELECT count(*) as cnt, 'Bad' as st, source_ip, 1 as state FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582614761) AND status = 8 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10     UNION ALL     SELECT count(*) as cnt, 'Bad' as st, source_ip, 1 as state FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582614761) AND status = 9 GROUP BY source_ip ORDER BY cnt DESC LIMIT 10 ) ORDER BY cnt DESC LIMIT 10",
          "refId": "A",
          "round": "0s",
          "table": "sip_transaction_call",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 10 Union ALL",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE}",
      "fontSize": "100%",
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 14
      },
      "id": 7,
      "links": [],
      "options": {},
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Counter",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "link": false,
          "pattern": "cnt",
          "type": "number",
          "unit": "none"
        },
        {
          "alias": "MOS",
          "colorMode": "row",
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "#FADE2A",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 0,
          "mappingType": 1,
          "pattern": "mos",
          "thresholds": [
            "380",
            "400"
          ],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "hepic_data",
          "dateColDataType": "",
          "dateLoading": false,
          "dateTimeColDataType": "record_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT count(*) as cnt, source_ip, mos FROM $table WHERE $timeFilter AND mos > 0 GROUP BY source_ip, mos ORDER BY mos DESC LIMIT 20  \n",
          "rawQuery": "SELECT count(*) as cnt, source_ip, mos FROM hepic_data.rtp_stats WHERE record_datetime >= toDateTime(1582614761) AND mos > 0 GROUP BY source_ip, mos ORDER BY mos DESC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "rtp_stats",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "MOS Good Actors",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE}",
      "fontSize": "100%",
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 14
      },
      "id": 6,
      "links": [],
      "options": {},
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Counter",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "link": false,
          "pattern": "cnt",
          "type": "number",
          "unit": "none"
        },
        {
          "alias": "MOS",
          "colorMode": "row",
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "#FADE2A",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 0,
          "mappingType": 1,
          "pattern": "mos",
          "thresholds": [
            "380",
            "400"
          ],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "hepic_data",
          "dateColDataType": "",
          "dateLoading": false,
          "dateTimeColDataType": "record_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT count(*) as cnt, source_ip, mos FROM $table WHERE $timeFilter AND mos > 0 GROUP BY source_ip, mos ORDER BY mos ASC LIMIT 20  \n",
          "rawQuery": "SELECT count(*) as cnt, source_ip, mos FROM hepic_data.rtp_stats WHERE record_datetime >= toDateTime(1582614761) AND mos > 0 GROUP BY source_ip, mos ORDER BY mos ASC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "rtp_stats",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "MOS Bad Actors",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_CLICKHOUSE}",
      "fontSize": "100%",
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 24
      },
      "id": 2,
      "options": {},
      "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)"
          ],
          "decimals": 2,
          "pattern": "/.*/",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "hepic_data",
          "dateColDataType": "",
          "dateLoading": false,
          "dateTimeColDataType": "record_datetime",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "table",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    count(*) as cnt, status, source_ip\nFROM $table\nWHERE $timeFilter\nGROUP BY status, source_ip ORDER BY cnt DESC LIMIT 10\n",
          "rawQuery": "SELECT     count(*) as cnt, status, source_ip FROM hepic_data.sip_transaction_call WHERE record_datetime >= toDateTime(1582614761) GROUP BY status, source_ip ORDER BY cnt DESC LIMIT 10",
          "refId": "A",
          "round": "0s",
          "table": "sip_transaction_call",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Panel Title",
      "transform": "table",
      "type": "table"
    }
  ],
  "schemaVersion": 18,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-2h",
    "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": "HEPIC TOP Stats",
  "uid": "jbc5VrwWk",
  "version": 35
}