Grafana dashboard: OsTicket Dashboard Statistics
Description: Dashboard simples para exibir a saude do servicedesk durante o dia.


{
  "__inputs": [
    {
      "name": "DS_OSTICKET",
      "label": "osTicket",
      "description": "",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.3.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "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": 10840,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "content": "<table width='100%' border=0>\n  <tr>\n    <td align='center'><h1>Service Desk TI Polimetri</h1></td>\n  </tr>\n</table>\n\n\n\n\n\n",
      "gridPos": {
        "h": 2,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 12,
      "mode": "html",
      "options": {},
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "type": "text"
    },
    {
      "cacheTimeout": null,
      "colorBackground": true,
      "colorPostfix": false,
      "colorPrefix": false,
      "colorValue": false,
      "colors": [
        "#56A64B",
        "#FADE2A",
        "#d44a3a"
      ],
      "datasource": "${DS_OSTICKET}",
      "description": "",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 8,
        "w": 5,
        "x": 0,
        "y": 2
      },
      "id": 2,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "100%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "Abertos",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "Situacao",
          "rawQuery": true,
          "rawSql": "select count(*) Abertos\r\n  from ost_ticket \r\n where closed is null",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "ticket_id"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "v_relat",
          "timeColumn": "DataCriacao",
          "timeColumnType": "datetime",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": "50,80",
      "timeFrom": null,
      "timeShift": null,
      "title": "Tickets Em Aberto",
      "type": "singlestat",
      "valueFontSize": "200%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_OSTICKET}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 5,
        "y": 2
      },
      "id": 16,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": " Abertos Hoje",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "Qtd",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select 'Abertos Hoje' Abertos\r\n     , count(*) Qtd\r\n  from ost_ticket t\r\n where cast(t.created as date) = cast(now() as date)\r\n group by 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "type": "singlestat",
      "valueFontSize": "200%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_OSTICKET}",
      "description": "",
      "gridPos": {
        "h": 8,
        "w": 5,
        "x": 9,
        "y": 2
      },
      "id": 10,
      "links": [],
      "options": {
        "fieldOptions": {
          "calcs": [
            "mean"
          ],
          "defaults": {
            "mappings": [],
            "max": 100,
            "min": 0,
            "thresholds": [
              {
                "color": "semi-dark-green",
                "value": null
              },
              {
                "color": "light-yellow",
                "value": 40
              },
              {
                "color": "dark-red",
                "value": 80
              }
            ],
            "unit": "percent"
          },
          "override": {},
          "values": false
        },
        "orientation": "auto",
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "pluginVersion": "6.3.3",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select (sum(case when t.created + interval s.grace_period hour <= now() then 1 else 0 end) / count(*)) * 100 pct_sla_vencido\r\n  from ost_ticket t\r\n  left join ost_sla s\r\n    on s.id = t.sla_id\r\n where closed is null\r\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "SLA Vencido",
      "type": "gauge"
    },
    {
      "columns": [],
      "datasource": "${DS_OSTICKET}",
      "fontSize": "120%",
      "gridPos": {
        "h": 8,
        "w": 5,
        "x": 14,
        "y": 2
      },
      "id": 14,
      "options": {},
      "pageSize": null,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Qtd",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Qtd",
          "type": "number",
          "unit": "none"
        }
      ],
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select ts.name Status\r\n     , count(*) Qtd\r\n  from ost_ticket t\r\n  left join ost_ticket_status ts\r\n    on ts.id = t.status_id\r\n where ts.state = 'open'\r\n group by 1\r\n order by 2 desc, 1\r\n",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Em aberto por Status",
      "transform": "table",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "${DS_OSTICKET}",
      "fontSize": "130%",
      "gridPos": {
        "h": 8,
        "w": 5,
        "x": 19,
        "y": 2
      },
      "id": 8,
      "options": {},
      "pageSize": null,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "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,
          "link": false,
          "mappingType": 1,
          "pattern": "Qtd",
          "thresholds": [
            "10",
            "20"
          ],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select ifnull(d.dept_name,\"Aguardando\") \"Atendido Por\"\r\n     , count(1) Qtd\r\n  from ost_ticket t\r\n  left join ost_staff st\r\n    on st.staff_id = t.staff_id\r\n  left join ost_department d\r\n    on d.dept_id = st.dept_id\r\n where closed is null\r\n group by 1\r\n order by 1 ",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Tickets Por Departamento",
      "transform": "table",
      "type": "table"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_OSTICKET}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 5,
        "y": 6
      },
      "id": 19,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": " Encerrados Hoje",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false,
        "ymax": null,
        "ymin": null
      },
      "tableColumn": "Qtd",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select 'Encerrados Hoje' Encerrados\r\n     , count(*) Qtd\r\n  from ost_ticket t\r\n where cast(t.closed as date) = cast(now() as date)\r\n group by 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "type": "singlestat",
      "valueFontSize": "200%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "columns": [],
      "datasource": "${DS_OSTICKET}",
      "description": "Quantidade de Chamados abertos neste momento por Idade",
      "fontSize": "110%",
      "gridPos": {
        "h": 8,
        "w": 6,
        "x": 0,
        "y": 10
      },
      "id": 4,
      "options": {},
      "pageSize": null,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": false
      },
      "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": 0,
          "pattern": "/.*/",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "format": "table",
          "group": [],
          "hide": false,
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select case \r\n            when TIMESTAMPDIFF(HOUR,t.created,ifnull(t.closed,now())) <= 02 then '0.Até 02 Horas'\r\n            when TIMESTAMPDIFF(HOUR,t.created,ifnull(t.closed,now())) <= 04 then '1.Até 04 Horas'\r\n            when TIMESTAMPDIFF(HOUR,t.created,ifnull(t.closed,now())) <= 08 then '2.Até 08 Horas'\r\n            when TIMESTAMPDIFF(HOUR,t.created,ifnull(t.closed,now())) <= 24 then '3.Até 24 Horas'\r\n            when TIMESTAMPDIFF( DAY,t.created,ifnull(t.closed,now())) <= 02 then '4.Até 02 Dias'\r\n            when TIMESTAMPDIFF( DAY,t.created,ifnull(t.closed,now())) <= 07 then '5.Até 07 Dias'\r\n            when TIMESTAMPDIFF( DAY,t.created,ifnull(t.closed,now()))  > 07 then '6.Mais 08 Dias'\r\n          end IdadeCriacao\r\n      , count(*) Qtd\r\n  from ost_ticket t\r\n where closed is null\r\n group by 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Em Aberto Por Idade",
      "transform": "table",
      "type": "table"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_OSTICKET}",
      "decimals": 0,
      "fill": 2,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 18,
        "x": 6,
        "y": 10
      },
      "hideTimeOverride": false,
      "id": 6,
      "interval": "",
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 3,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "back"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select cast(t.data_hora as date) time\r\n     , (select count(*) from ost_ticket\r\n         where cast(created as date) <= t.data_hora\r\n           and (closed is null or cast(closed as date) > t.data_hora)) Backlog\r\n  from (select cast(created as date) as data_hora from ost_ticket where created >= now() - interval 3 month\r\n         union \r\n        select cast(closed as date) as data_hora from ost_ticket where closed >= now() - interval 3 month) t\r\n order by 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "time",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Backlog de Tickets",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "1m",
  "schemaVersion": 19,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-30d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "OsTicket Dashboard Statistics",
  "uid": "8VJ_PAcWz",
  "version": 30,
  "description": "Dashboard simples para exibir a saude do servicedesk durante o dia."
}