Grafana dashboard: OTRS - Enquete
Description: Dashboard para leitura de dados do módulo survey do OTRS v5


{
  "__inputs": [
    {
      "name": "DS_MARIADB_OTRS",
      "label": "MariaDB otrs",
      "description": "",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.0.4"
    },
    {
      "type": "panel",
      "id": "grafana-piechart-panel",
      "name": "Pie Chart",
      "version": "1.3.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": "5.0.0"
    },
    {
      "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"
      }
    ]
  },
  "editable": false,
  "gnetId": 8910,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1541870968944,
  "links": [
    {
      "asDropdown": true,
      "icon": "external link",
      "tags": [
        "otrs"
      ],
      "title": "",
      "type": "dashboards"
    }
  ],
  "panels": [
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_MARIADB_OTRS}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 30,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "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
      },
      "tableColumn": "",
      "targets": [
        {
          "alias": "",
          "format": "time_series",
          "rawSql": "SELECT \nUNIX_TIMESTAMP(th.create_time) as time_sec,\ncount(*) as value,\nts.name as metric\nFROM ticket_history th\nJOIN ticket t ON (th.ticket_id=t.id)\nJOIN users u ON (th.owner_id=u.id)\nJOIN ticket_state ts ON (th.state_id=ts.id)\nJOIN ticket_state_type tst ON (ts.type_id=tst.id)\nWHERE\ntst.name = 'closed'\nAND th.history_type_id = 27\nAND $__timeFilter(th.create_time)",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "title": "Chamados fechados",
      "type": "singlestat",
      "valueFontSize": "80%",
      "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_MARIADB_OTRS}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 3,
        "y": 0
      },
      "id": 31,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "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
      },
      "tableColumn": "",
      "targets": [
        {
          "alias": "",
          "format": "time_series",
          "rawSql": "SELECT \nUNIX_TIMESTAMP(survey_request.create_time) as time_sec,\ncount(survey_request.id) as value,\n'chamados' as metric\nFROM survey_request\nWHERE\n$__timeFilter(survey_request.create_time)\n\n",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "title": "Solicitações enviadas",
      "type": "singlestat",
      "valueFontSize": "80%",
      "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_MARIADB_OTRS}",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 6,
        "y": 0
      },
      "id": 32,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "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
      },
      "tableColumn": "",
      "targets": [
        {
          "alias": "",
          "format": "time_series",
          "rawSql": "SELECT \nUNIX_TIMESTAMP(survey_request.vote_time) as time_sec,\ncount(survey_request.id) as value,\n'chamados' as metric\nFROM survey_request\nWHERE\nvote_time IS NOT NULL\nAND\n$__timeFilter(survey_request.vote_time)\n\n",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "title": "Solicitações respondidas",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "0",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "aliasColors": {},
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_MARIADB_OTRS}",
      "decimals": null,
      "fill": 1,
      "gridPos": {
        "h": 4,
        "w": 14,
        "x": 10,
        "y": 0
      },
      "id": 46,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": false,
        "sideWidth": null,
        "total": true,
        "values": true
      },
      "lines": false,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "",
          "format": "time_series",
          "rawSql": "SELECT \n$__timeGroup(survey_request.vote_time,'24h') as time_sec,\ncount(survey_request.id) as value,\n'Respostas' as metric\nFROM survey_request\nWHERE\nvote_time IS NOT NULL\nAND\n$__timeFilter(survey_request.vote_time)\nGROUP BY 1\nORDER BY 1\n\n",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Respostas",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "decimals": null,
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ]
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 4
      },
      "id": 16,
      "panels": [],
      "repeat": "questao",
      "title": "$questao",
      "type": "row"
    },
    {
      "aliasColors": {},
      "breakPoint": "25%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_MARIADB_OTRS}",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 9,
        "w": 7,
        "x": 0,
        "y": 5
      },
      "id": 6,
      "interval": null,
      "legend": {
        "header": "",
        "percentage": true,
        "show": true,
        "values": true
      },
      "legendType": "On graph",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "repeat": null,
      "repeatDirection": "v",
      "strokeWidth": 1,
      "targets": [
        {
          "alias": "",
          "format": "time_series",
          "rawSql": "SELECT\n  UNIX_TIMESTAMP(sv.create_time) as time_sec,\n  count(vote_value) as value,\n  answer as metric\nFROM survey_vote sv\nJOIN survey_answer sa ON (sv.vote_value=sa.id)\nJOIN survey_question sq ON (sq.id=sv.question_id)\nWHERE\n$__timeFilter(sv.create_time)\nAND sq.question = $questao\nGROUP BY vote_value\nORDER BY sa.position\n",
          "refId": "A"
        }
      ],
      "title": "",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "columns": [],
      "datasource": "${DS_MARIADB_OTRS}",
      "fontSize": "100%",
      "gridPos": {
        "h": 9,
        "w": 17,
        "x": 7,
        "y": 5
      },
      "id": 4,
      "links": [],
      "minSpan": 1,
      "pageSize": 500,
      "repeat": null,
      "repeatDirection": "v",
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Time",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "Número",
          "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,
          "linkTargetBlank": true,
          "linkTooltip": "Ver chamado no OTRS",
          "linkUrl": "http://servidor.otrs/otrs/index.pl?Action=AgentTicketZoom;TicketNumber=$__cell",
          "pattern": "tn",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        },
        {
          "alias": "Avaliação",
          "colorMode": "cell",
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(245, 54, 54, 0.9)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "link": false,
          "pattern": "answer",
          "preserveFormat": false,
          "sanitize": false,
          "thresholds": [
            "Ótimo",
            " Bom"
          ],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Título do chamado",
          "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,
          "linkTargetBlank": true,
          "linkTooltip": "Ver chamado no OTRS",
          "linkUrl": "http://servidor.otrs/otrs/index.pl?Action=AgentTicketZoom;TicketNumber=$__cell_0",
          "pattern": "title",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "Fila",
          "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,
          "pattern": "name",
          "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  t.tn,\n  t.title,\n  q.name,\n  sa.answer\nFROM survey_vote sv\nJOIN survey_answer sa ON (sv.vote_value=sa.id)\nJOIN survey_question sq ON (sq.id=sv.question_id)\nJOIN survey_request sr ON (sv.request_id=sr.id)\nJOIN ticket t ON (t.id=sr.ticket_id)\nJOIN queue q ON (t.queue_id=q.id)\nWHERE\n$__timeFilter(sv.create_time)\nAND\nsq.question IN ($questao)\nORDER BY sa.position, t.tn DESC",
          "refId": "A"
        }
      ],
      "title": "Chamados avaliados",
      "transform": "table",
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "otrs"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_MARIADB_OTRS}",
        "hide": 2,
        "includeAll": true,
        "label": "Questão",
        "multi": false,
        "name": "questao",
        "options": [],
        "query": "SELECT question FROM survey_question sq JOIN survey s ON (s.id=sq.survey_id AND s.status='Master')",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-1y",
    "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": "OTRS - Enquete",
  "uid": "s_-fpY-mz",
  "version": 70,
  "description": "Dashboard para leitura de dados do módulo survey do OTRS v5"
}