grafana-dashboards/Layer Statistics.json
2023-05-02 12:17:43 -04:00

467 lines
13 KiB
JSON

{
"__inputs": [
{
"name": "DS_MYSQL",
"label": "MySQL",
"description": "",
"type": "datasource",
"pluginId": "mysql",
"pluginName": "MySQL"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "9.4.7"
},
{
"type": "datasource",
"id": "mysql",
"name": "MySQL",
"version": "1.0.0"
},
{
"type": "panel",
"id": "piechart",
"name": "Pie chart",
"version": ""
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 13,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"footer": {
"countRows": false,
"enablePagination": true,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": false,
"displayName": "layer"
}
]
},
"pluginVersion": "9.4.7",
"targets": [
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT layer, winner as \"faction\", ((wins / matchcnt) * 100) as \"win percent\", wins as \"number of wins\", matchcnt as \"number of matches\"\nFROM (SELECT layer, winner, count(*) AS \"wins\",\n (\n SELECT count(*)\n FROM (\n SELECT mat.id, mat.layerClassname, mat.map, mat.layer, mat.startTime, mat.endTime, mat.winner, mat.server,\n (select avg(pc.players)\n from DBLog_PlayerCounts as pc\n where\n pc.`match`=mat.id\n ) as playercnt\n from DBLog_Matches as mat\n ) as mcdbm\n WHERE\n mcdbm.layer = dbm.layer and\n playercnt>50\n GROUP BY mcdbm.layer\n ) as \"matchcnt\"\nFROM (\n SELECT mat.id, mat.layerClassname, mat.map, mat.layer, mat.startTime, mat.endTime, mat.winner, mat.server,\n (select avg(pc.players)\n from DBLog_PlayerCounts as pc\n where\n pc.`match`=mat.id\n ) as playercnt\n from DBLog_Matches as mat\n ) as dbm\nWHERE\n dbm.layer IS NOT NULL AND\n dbm.winner IS NOT NULL AND\n not dbm.map=\"Jensen\\'s\" and\n not dbm.layerClassname REGEXP \".*_Seed_.*\" and\n playercnt>50 and\n dbm.server = $SERVER\nGROUP BY layer, winner\nORDER BY wins desc) AS winraw\nORDER BY `win percent` DESC, `number of matches` DESC",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Layer Info",
"type": "table"
},
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": []
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 4,
"x": 0,
"y": 13
},
"id": 4,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^matches$/",
"values": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT dbmat.map, count(*) as \"matches\"\nFROM (\n SELECT mat.id, mat.layerClassname, mat.map, mat.layer, mat.startTime, mat.endTime, mat.winner, mat.server,\n (select avg(pc.players)\n from DBLog_PlayerCounts as pc\n where\n pc.`match`=mat.id\n ) as playercnt\n from DBLog_Matches as mat\n ) as dbmat\nwhere\n layer is not null and\n winner is not null and\n not map=\"Jensen\\'s\" AND\n not layerClassname regexp \".*_Seed_.*\" and\n playercnt>50 and\n server = $SERVER\ngroup by map\norder by matches",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Maps Played",
"type": "piechart"
},
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false,
"width": 100
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "layer"
},
"properties": [
{
"id": "custom.width"
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 7,
"x": 4,
"y": 13
},
"id": 6,
"options": {
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "9.4.7",
"targets": [
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "select layer, substring_index(substring_index(layerClassname,'_',2),'_',-1) as gamemode,avg(time_to_sec(timediff(endTime, startTime)))/3600 as avgTime\nfrom (SELECT mat.id, mat.layerClassname, mat.map, mat.layer, mat.startTime, mat.endTime, mat.winner, mat.server,\n (select avg(pc.players)\n from DBLog_PlayerCounts as pc\n where\n pc.`match`=mat.id\n ) as playercnt\nfrom DBLog_Matches as mat where mat.layer is not null) as mt\nwhere playercnt > 50 and server = $SERVER\ngroup by layer\norder by avgTime desc",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "average lengths",
"type": "table"
},
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 7,
"x": 11,
"y": 13
},
"id": 7,
"options": {
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "9.4.7",
"targets": [
{
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "select substring_index(substring_index(layerClassname,'_',2),'_',-1) as gamemode,avg(time_to_sec(timediff(endTime, startTime)))/3600 as avgTime\nfrom (SELECT mat.id, mat.layerClassname, mat.map, mat.layer, mat.startTime, mat.endTime, mat.winner, mat.server,\n (select avg(pc.players)\n from DBLog_PlayerCounts as pc\n where\n pc.`match`=mat.id\n ) as playercnt\nfrom DBLog_Matches as mat where mat.layer is not null) as mt\nwhere playercnt > 50 and server = $SERVER and layerClassname not regexp \"Seed\"\ngroup by gamemode\norder by avgTime desc",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "average lengths",
"type": "table"
}
],
"refresh": "5m",
"revision": 1,
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {},
"datasource": {
"type": "mysql",
"uid": "${DS_MYSQL}"
},
"definition": "SELECT id as __value, trim(leading '[ASG] Asgard Eternal | ' from name) as __text\nFROM DBLog_Servers",
"hide": 0,
"includeAll": false,
"multi": false,
"name": "SERVER",
"options": [],
"query": "SELECT id as __value, trim(leading '[ASG] Asgard Eternal | ' from name) as __text\nFROM DBLog_Servers",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"hidden": true
},
"timezone": "",
"title": "Layer Statistics",
"uid": "ayrMxLA4k",
"version": 13,
"weekStart": ""
}