Grafana dashboard: Asterisk CDR Dashboard
Description: Dashboard for MySQL backed asteriskcdrdb

This is my first version of my asterisk CDR Dashboard pulling from mysql asteriskcdrdb table.
This just queries the cdr table and uses grafana time range to filter records.

Add asteriskcdrdb as a source and add dashboard.


{
  "__inputs": [
    {
      "name": "DS_ASTERISK",
      "label": "Asterisk",
      "description": "",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.6.2"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 6359,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [],
  "rows": [
    {
      "collapse": false,
      "height": 599,
      "panels": [
        {
          "columns": [
            {
              "text": "Total",
              "value": "total"
            }
          ],
          "datasource": "${DS_ASTERISK}",
          "fontSize": "100%",
          "id": 2,
          "links": [],
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 0,
            "desc": false
          },
          "span": 6,
          "styles": [
            {
              "alias": "NAME",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": null,
              "pattern": "Metric",
              "preserveFormat": false,
              "sanitize": false,
              "thresholds": [],
              "type": "string",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT clid as metric,\n  count(*) as value,\n  UNIX_TIMESTAMP(calldate) as time_sec\nFROM cdr\nWHERE ($__timeFilter(calldate) and (duration > '15') and length(src)=3 and length(dst)>3 and (disposition='ANSWERED'))\nand src not like 660 and src not like 654 and src not like 657 and src not like 647 and src not like 605 and src not like 615 and src not like '4%' and src not like 642 and src not like 617\nand src not like 646 and src not like 645 and src not like 600 and src not like 650 and src not like 648 and src not like '7%' and src not like 612 and src not like 652\nand src not like 609 and src not like 656 and src not like 644 and src not like 604 and src not like '3%' and src not like 655 and src not like 649 and src not like 614 and src not like 620\nGROUP BY clid\nORDER BY value",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "title": "Табличный вид",
          "transform": "timeseries_aggregations",
          "type": "table"
        },
        {
          "aliasColors": {},
          "bars": true,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_ASTERISK}",
          "fill": 1,
          "hideTimeOverride": false,
          "id": 3,
          "legend": {
            "alignAsTable": false,
            "avg": false,
            "current": false,
            "hideEmpty": false,
            "hideZero": false,
            "max": false,
            "min": false,
            "rightSide": false,
            "show": false,
            "total": false,
            "values": false
          },
          "lines": false,
          "linewidth": 1,
          "links": [],
          "minSpan": null,
          "nullPointMode": "null",
          "percentage": true,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 6,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "",
              "format": "time_series",
              "rawSql": "SELECT\n  UNIX_TIMESTAMP(calldate) as time_sec,\n  clid as metric,\n  count(*) as value\nFROM cdr\nWHERE ($__timeFilter(calldate) and ((src='606') or (src='608') or (src='680') or (src='681') or (src='682') or (src='659') or (src='632')) and length(src)=3 and length(dst)>3 and (duration > '15') and (disposition='ANSWERED'))\nGROUP BY clid\nORDER BY value DESC\n",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Статистика звонков",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": false,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "series",
            "name": null,
            "show": true,
            "values": [
              "total"
            ]
          },
          "yaxes": [
            {
              "decimals": null,
              "format": "short",
              "label": "Количество",
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": "",
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2018-01-14T22:48:26.000Z",
    "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": "Asterisk CDR Dashboard",
  "version": 63,
  "description": "Dashboard for MySQL backed asteriskcdrdb"
}