Servidor de Impressão Windows
Log de impressões do Windows Server 2019 em banco de dados MySQL
{
  "__inputs": [
    {
      "name": "DS_MYSQL-PRINTLOG",
      "label": "MySQL-PrintLog",
      "description": "",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.0.0"
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "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": 14776,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 0,
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 10,
        "x": 0,
        "y": 0
      },
      "id": 9,
      "interval": null,
      "links": [],
      "options": {
        "displayLabels": [],
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "right",
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "7.3.1",
      "targets": [
        {
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "queryType": "randomWalk",
          "rawQuery": true,
          "rawSql": "SELECT now() as time, user AS \"Login\",\nsum(totalpages) AS \"Total\"\nfrom printlog \nWHERE MONTH(timecreated) = MONTH(NOW())\nAND YEAR(timecreated) = YEAR(NOW())\ngroup by user ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Impressões (Mês)",
      "type": "piechart"
    },
    {
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 5,
        "x": 10,
        "y": 0
      },
      "id": 4,
      "options": {
        "showHeader": true
      },
      "pluginVersion": "8.0.0",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "queryType": "randomWalk",
          "rawQuery": true,
          "rawSql": "SELECT user AS \"Login\" , SUM(totalpages) AS \"Total\"\n        FROM printlog\nWHERE MONTH(timecreated) = MONTH(NOW())\n        AND YEAR(timecreated) = YEAR(NOW())\n        GROUP BY user\n        ORDER BY total DESC LIMIT 10;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "numberofcopies"
                ],
                "type": "column"
              }
            ],
            [
              {
                "params": [
                  "user"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": []
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 10 (Login)",
      "type": "table"
    },
    {
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "deion": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 5,
        "x": 15,
        "y": 0
      },
      "id": 5,
      "options": {
        "showHeader": true
      },
      "pluginVersion": "8.0.0",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "queryType": "randomWalk",
          "rawQuery": true,
          "rawSql": "SELECT printer AS \"Impressora\", SUM(totalpages)as \"Total\" \nFROM printlog \nWHERE MONTH(timecreated) = MONTH(NOW())\nAND YEAR(timecreated) = YEAR(NOW())\nGROUP BY printer DESC LIMIT 10;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "numberofcopies"
                ],
                "type": "column"
              }
            ],
            [
              {
                "params": [
                  "user"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": []
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 10 (Impressoras)",
      "type": "table"
    },
    {
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "deion": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Login"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 176
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Total"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 104
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 12,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "id": 13,
      "options": {
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.0.0",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "queryType": "randomWalk",
          "rawQuery": true,
          "rawSql": "SELECT user AS Login , SUM(totalpages) as Total FROM printlog WHERE DATE(timecreated) = CURDATE() GROUP BY user order by sum(totalpages) desc LIMIT 10;",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "numberofcopies"
                ],
                "type": "column"
              }
            ],
            [
              {
                "params": [
                  "user"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": []
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "TOP 10 (Hoje)",
      "type": "table"
    },
    {
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "deion": "",
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#ffffffff",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 0,
        "y": 9
      },
      "id": 7,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.0.0",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "queryType": "randomWalk",
          "rawQuery": true,
          "rawSql": "SELECT SUM(totalpages) from printlog limit 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Páginas impressas (Total)",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "deion": "",
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#ffffffff",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 3,
        "y": 9
      },
      "id": 12,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.0.0",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "queryType": "randomWalk",
          "rawQuery": true,
          "rawSql": "SELECT SUM(totalpages) from printlog WHERE DATE(timecreated) = SUBDATE(CURDATE(),1)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Páginas impressas (Ontem)",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "deion": "",
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#ffffff",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 7,
        "y": 9
      },
      "id": 11,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "8.0.0",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "queryType": "randomWalk",
          "rawQuery": true,
          "rawSql": "SELECT SUM(totalpages) from printlog WHERE  DATE(timecreated) = CURDATE()",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Páginas impressas (Dia)",
      "type": "stat"
    },
    {
      "datasource": "${DS_MYSQL-PRINTLOG}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "left",
            "displayMode": "auto",
            "filterable": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Tamanho"
            },
            "properties": [
              {
                "id": "unit",
                "value": "decbytes"
              },
              {
                "id": "custom.width",
                "value": 118
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Total"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "rgba(115, 191, 105, 0)",
                      "value": null
                    },
                    {
                      "color": "#EAB839",
                      "value": 30
                    },
                    {
                      "color": "red",
                      "value": 50
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Trabalho"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 97
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Estação"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 146
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Impressora"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 136
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Páginas"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 97
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Cópias"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 93
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Arquivo"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 627
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 14,
        "w": 24,
        "x": 0,
        "y": 12
      },
      "id": 2,
      "options": {
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.0.0",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": true,
          "rawSql": "SELECT\n  jobid AS \"Trabalho\",\n  DATE_FORMAT(timecreated, \"%d/%m/%Y %T\") as \"DATA\",\n  client AS \"Estação\",\n  user AS \"Login\",\n  printer AS \"Impressora\",\n  filename AS \"Arquivo\",\n  jobbytes AS \"Tamanho\",\n  pagecount AS \"Páginas\",\n  numberofcopies AS \"Cópias\",\n  totalpages AS \"Total\"\nFROM printlog",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "column"
              }
            ]
          ],
          "table": "printlog",
          "timeColumn": "timecreated",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Logs",
      "type": "table"
    }
  ],
  "refresh": "1m",
  "schemaVersion": 30,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Servidor de Impressão Windows",
  "uid": "uhqhWLZ7k",
  "version": 3,
  "description": "Log de impressões do Windows Server 2019 em banco de dados MySQL"
}