Controle de consumo da franquia - Minutagem
Painel para controle de consumo de minutos de chamadas realizadas.
O painel considera uma franquia de minutos que pode ser definida nas variáveis e selecionada na lista para efeito do calculo dos minutos excedentes e sua respectiva cobraça, que usa variáveis com os valores das tarifas.
{
  "__inputs": [
    {
      "name": "DS_MYSQL_ASTERISK",
      "label": "MySQL_Asterisk",
      "description": "Tabela de bilhetes CDR' das chamadas.",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.3.7"
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "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": 16331,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1653585233222,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 0,
        "y": 0
      },
      "id": 5,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 1\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "JANEIRO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 2,
        "y": 0
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 2\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "FEVEREIRO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 4,
        "y": 0
      },
      "id": 10,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 3\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "MARÇO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 6,
        "y": 0
      },
      "id": 9,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 4\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "ABRIL",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 8,
        "y": 0
      },
      "id": 8,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 5\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "MAIO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 10,
        "y": 0
      },
      "id": 7,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(duration)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 6\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "JUNHO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 12,
        "y": 0
      },
      "id": 11,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(duration)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 7\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "JULHO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 14,
        "y": 0
      },
      "id": 13,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(duration)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 8\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "AGOSTO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 16,
        "y": 0
      },
      "id": 16,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(duration)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 9\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "SETEMBRO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 18,
        "y": 0
      },
      "id": 15,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(duration)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 10\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "OUTUBRO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 20,
        "y": 0
      },
      "id": 14,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(duration)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 11\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "NOVEMBRO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "noValue": "-",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 22,
        "y": 0
      },
      "id": 17,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(duration)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = 12\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "DEZEMBRO",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "minutos"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dthms"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "data"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 287
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 4
      },
      "id": 12,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec) as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = $Mes\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "billsec"
                ],
                "type": "column"
              },
              {
                "params": [
                  "billsec"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "disposition",
                "=",
                "'ANSWERED'"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Horas, Minutos e Segundos",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 7000
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 12,
        "y": 4
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec)/60 as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = $Mes\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Minutos consumidos",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 0,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 1
              }
            ]
          },
          "unit": "locale"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 11
      },
      "id": 18,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,sum(billsec)/60-$franquia as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = $Mes\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Minutos Excedentes",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL_ASTERISK}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {},
          "decimals": 3,
          "mappings": [],
          "max": 10000,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-red",
                "value": null
              }
            ]
          },
          "unit": "currencyBRL"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 11
      },
      "id": 19,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "/^minutos$/",
          "values": true
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "select date(calldate) as data,(sum(billsec)/60-$franquia)*$tarifa as minutos from cdr_local\nwhere dcontext = \"out_stfc\" \nAND disposition = \"ANSWERED\" \nAND month(calldate) = $Mes\nAND year(calldate) = 2022 \ngroup by month(calldate)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "duration"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Custo Excedentes - Franquia $franquia",
      "type": "stat"
    }
  ],
  "refresh": "1m",
  "schemaVersion": 26,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {
          "selected": true,
          "text": "5",
          "value": "5"
        },
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Mês",
        "multi": false,
        "name": "Mes",
        "options": [
          {
            "selected": false,
            "text": "1",
            "value": "1"
          },
          {
            "selected": false,
            "text": "2",
            "value": "2"
          },
          {
            "selected": false,
            "text": "3",
            "value": "3"
          },
          {
            "selected": false,
            "text": "4",
            "value": "4"
          },
          {
            "selected": true,
            "text": "5",
            "value": "5"
          },
          {
            "selected": false,
            "text": "6",
            "value": "6"
          },
          {
            "selected": false,
            "text": "7",
            "value": "7"
          },
          {
            "selected": false,
            "text": "8",
            "value": "8"
          },
          {
            "selected": false,
            "text": "9",
            "value": "9"
          },
          {
            "selected": false,
            "text": "10",
            "value": "10"
          },
          {
            "selected": false,
            "text": "11",
            "value": "11"
          },
          {
            "selected": false,
            "text": "12",
            "value": "12"
          }
        ],
        "query": "1,2,3,4,5,6,7,8,9,10,11,12",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {
          "selected": true,
          "text": "10000",
          "value": "10000"
        },
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Franquia",
        "multi": false,
        "name": "franquia",
        "options": [
          {
            "selected": false,
            "text": "2000",
            "value": "2000"
          },
          {
            "selected": false,
            "text": "3000",
            "value": "3000"
          },
          {
            "selected": false,
            "text": "5000",
            "value": "5000"
          },
          {
            "selected": true,
            "text": "10000",
            "value": "10000"
          },
          {
            "selected": false,
            "text": "15000",
            "value": "15000"
          },
          {
            "selected": false,
            "text": "20000",
            "value": "20000"
          },
          {
            "selected": false,
            "text": "25000",
            "value": "25000"
          },
          {
            "selected": false,
            "text": "30000",
            "value": "30000"
          }
        ],
        "query": "2000,3000,5000,10000,15000,20000,25000,30000",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": null,
        "current": {
          "selected": true,
          "text": "0.13",
          "value": "0.13"
        },
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Tarifa",
        "multi": false,
        "name": "tarifa",
        "options": [
          {
            "selected": true,
            "text": "0.13",
            "value": "0.13"
          },
          {
            "selected": false,
            "text": "0.20",
            "value": "0.20"
          },
          {
            "selected": false,
            "text": "0.558",
            "value": "0.558"
          },
          {
            "selected": false,
            "text": "0.693",
            "value": "0.693"
          }
        ],
        "query": "0.13,0.20,0.558,0.693",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now/d",
    "to": "now/d"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Controle de consumo da franquia - Minutagem",
  "uid": "njWPrN_nk",
  "version": 8,
  "description": "Painel para controle de consumo de minutos de chamadas realizadas.\r\nO painel considera uma franquia de minutos que pode ser definida nas variáveis e selecionada na lista para efeito do calculo dos minutos excedentes e sua respectiva cobraça, que usa variáveis com os valores das tarifas."
}