{
  "__inputs": [
    {
      "name": "DS_POSTGRESQL",
      "label": "PostgreSQL",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "10.0.2"
    },
    { "type": "panel", "id": "piechart", "name": "Pie chart", "version": "" },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    { "type": "panel", "id": "stat", "name": "Stat", "version": "" },
    { "type": "panel", "id": "table", "name": "Table", "version": "" },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "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"
      },
      {
        "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
        "enable": true,
        "hide": false,
        "iconColor": "#1F60C4",
        "mappings": {
          "text": { "source": "field", "value": "reason" },
          "time": { "source": "field", "value": "downtime_start" },
          "timeEnd": { "source": "field", "value": "downtime_end" },
          "title": { "source": "field", "value": "reason" }
        },
        "name": "Server online",
        "target": {
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\n  $__timeGroupAlias(time,$__interval),\n  'Server Start' as title,\n  'The server has started.' as text,\n  'Server' as tags\nFROM\n  startup\nWHERE\n  $__timeFilter(time)\nORDER BY\n  time ASC",
          "refId": "Anno",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          }
        }
      },
      {
        "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
        "enable": true,
        "iconColor": "red",
        "name": "Server Offline",
        "target": {
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\n  $__timeGroupAlias(end_time,$__interval),\n  'Server Stop' as title,\n  'The server has stopped.' as text,\n  'Server' as tags\nFROM\n  startup\nWHERE\n  $__timeFilter(end_time)\nORDER BY\n  end_time ASC",
          "refId": "Anno",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          }
        }
      }
    ]
  },
  "description": "The dashboard of the time series plugin made by tricked",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "dark-blue", "value": null }]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 0, "y": 0 },
      "id": 8,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT \"time\", extract(epoch from (NOW() AT TIME ZONE 'UTC' - \"time\")) as time1 FROM startup ORDER BY time DESC LIMIT 1",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  { "name": "\"time\"", "type": "functionParameter" }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          },
          "table": "startup"
        }
      ],
      "title": "Uptime",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "dark-blue", "value": null },
              { "color": "dark-red", "value": 0 },
              { "color": "dark-blue", "value": 1 }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 3, "y": 0 },
      "id": 7,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT COUNT(*) FROM players WHERE online = true",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "name": "COUNT",
                "parameters": [{ "name": "*", "type": "functionParameter" }],
                "type": "function"
              }
            ],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50,
            "whereJsonTree": {
              "children1": [],
              "id": "898b99b9-89ab-4cde-b012-31895e5ed92d",
              "properties": { "conjunction": "OR" },
              "type": "group"
            }
          },
          "table": "players"
        }
      ],
      "title": "Online Players",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "dark-blue", "value": null },
              { "color": "orange", "value": 40 }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 6, "y": 0 },
      "id": 5,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT \"time\", value FROM threads WHERE\n  $__timeFilter(time)",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  { "name": "\"time\"", "type": "functionParameter" }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          },
          "table": "threads"
        }
      ],
      "title": "Threads",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "dark-blue", "value": null }]
          }
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 9, "y": 0 },
      "id": 12,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT COUNT(*) FROM players;",
          "refId": "A",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Unique Players",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "dark-blue", "value": null }]
          }
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 12, "y": 0 },
      "id": 13,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "/^Average Loaded Chunks$/",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\n  time_bucket('$__interval', time) AS time,\n  AVG(value) AS \"Average Loaded Chunks\"\nFROM\n  LoadedChunks\nWHERE\n  time > NOW() - interval '1 day'\nGROUP BY\n  time\nORDER BY\n  time;\n",
          "refId": "A",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Average Loaded Chunks",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [{ "color": "dark-blue", "value": null }]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 15, "y": 0 },
      "id": 10,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "/^value$/",
          "limit": 1,
          "values": true
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "WITH sessions AS (\n  SELECT\n    time_bucket('1 minute', time) AS session_start,\n    first(time, time) AS session_start_time,\n    last(time, time) AS session_end_time\n  FROM\n    userpresence\n  WHERE\n    $__timeFilter(time)\n  GROUP BY\n    session_start\n)\nSELECT\n  'Average Playtime' as metric,\n  AVG(EXTRACT(epoch FROM (session_end_time - session_start_time))) AS value\nFROM\n  sessions\nWHERE\n  session_end_time IS NOT NULL AND session_start_time IS NOT NULL\n",
          "refId": "A",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Average playtime",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "decimals": 2,
          "displayName": "TPS",
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "dark-red", "value": 15 },
              { "color": "#EAB839", "value": 18 },
              { "color": "dark-blue", "value": 19.5 }
            ]
          },
          "unit": "TPS"
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 18, "y": 0 },
      "id": 1,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "time_series",
          "rawQuery": true,
          "rawSql": "SELECT \"time\", value FROM tps WHERE $__timeFilter(time)",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  { "name": "\"time\"", "type": "functionParameter" }
                ],
                "type": "function"
              },
              {
                "parameters": [
                  { "name": "value", "type": "functionParameter" }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          },
          "table": "tps"
        }
      ],
      "title": "TPS",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "dark-red", "value": null },
              { "color": "dark-yellow", "value": 200 },
              { "color": "dark-blue", "value": 400 }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": { "h": 6, "w": 3, "x": 21, "y": 0 },
      "id": 14,
      "options": {
        "colorMode": "background",
        "graphMode": "area",
        "justifyMode": "center",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "time_series",
          "rawQuery": true,
          "rawSql": "SELECT\n  time_bucket('$__interval', time) AS time,\n  free\nFROM memory\nWHERE $__timeFilter(time)",
          "refId": "A",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          },
          "table": "memory"
        }
      ],
      "title": "Free RAM",
      "type": "stat"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "palette-classic" },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": { "legend": false, "tooltip": false, "viz": false },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": { "type": "linear" },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": { "group": "A", "mode": "none" },
            "thresholdsStyle": { "mode": "off" }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "red", "value": 80 }
            ]
          },
          "unit": "bytes"
        },
        "overrides": []
      },
      "gridPos": { "h": 7, "w": 7, "x": 0, "y": 6 },
      "id": 6,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": { "mode": "single", "sort": "none" }
      },
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "time_series",
          "rawQuery": true,
          "rawSql": "SELECT\n  time_bucket('$__interval', time) AS time,\n  AVG(max) AS avg_max,\n  AVG(free) AS avg_free,\n  AVG(allocated) AS avg_allocated\nFROM memory\nWHERE $__timeFilter(time)\nGROUP BY time\nORDER BY time\n",
          "refId": "A",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          },
          "table": "memory"
        }
      ],
      "title": "Ram",
      "type": "timeseries"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "palette-classic" },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 33,
            "gradientMode": "opacity",
            "hideFrom": { "legend": false, "tooltip": false, "viz": false },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": { "type": "linear" },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": { "group": "A", "mode": "none" },
            "thresholdsStyle": { "mode": "off" }
          },
          "decimals": 2,
          "displayName": "TPS",
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "dark-red", "value": 15 },
              { "color": "#EAB839", "value": 18 }
            ]
          },
          "unit": "TPS"
        },
        "overrides": []
      },
      "gridPos": { "h": 7, "w": 8, "x": 7, "y": 6 },
      "id": 15,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": { "mode": "single", "sort": "none" }
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "time_series",
          "rawQuery": true,
          "rawSql": "SELECT \"time\", value FROM tps WHERE $__timeFilter(time)",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  { "name": "\"time\"", "type": "functionParameter" }
                ],
                "type": "function"
              },
              {
                "parameters": [
                  { "name": "value", "type": "functionParameter" }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          },
          "table": "tps"
        }
      ],
      "title": "TPS",
      "type": "timeseries"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "palette-classic" },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 12,
            "gradientMode": "hue",
            "hideFrom": { "legend": false, "tooltip": false, "viz": false },
            "lineInterpolation": "linear",
            "lineStyle": { "fill": "solid" },
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": { "type": "linear" },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": { "group": "A", "mode": "none" },
            "thresholdsStyle": { "mode": "off" }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              { "color": "green", "value": null },
              { "color": "red", "value": 80 }
            ]
          },
          "unit": "ns"
        },
        "overrides": []
      },
      "gridPos": { "h": 7, "w": 9, "x": 15, "y": 6 },
      "id": 11,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": { "mode": "single", "sort": "none" }
      },
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "time_series",
          "rawQuery": true,
          "rawSql": "SELECT\n  time_bucket('$__interval', time) AS time,\n  AVG(nano_avg) AS avg_nano_avg,\n  AVG(nano_max) AS avg_nano_max,\n  AVG(nano_min) AS avg_nano_min,\n  AVG(nano_median) AS avg_nano_median\nFROM tps\nWHERE $__timeFilter(time)\nGROUP BY time\nORDER BY time",
          "refId": "A",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Tick Duration",
      "type": "timeseries"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "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": [
          {
            "matcher": { "id": "byName", "options": "_" },
            "properties": [
              { "id": "custom.cellOptions", "value": { "type": "image" } },
              { "id": "custom.width", "value": 29 }
            ]
          },
          {
            "matcher": { "id": "byName", "options": "name" },
            "properties": [{ "id": "custom.width", "value": 118 }]
          },
          {
            "matcher": { "id": "byName", "options": "online" },
            "properties": [{ "id": "custom.width", "value": 64 }]
          },
          {
            "matcher": { "id": "byName", "options": "dim" },
            "properties": [{ "id": "custom.width", "value": 121 }]
          },
          {
            "matcher": { "id": "byName", "options": "online for" },
            "properties": [
              { "id": "unit", "value": "s" },
              { "id": "custom.width", "value": 105 }
            ]
          }
        ]
      },
      "gridPos": { "h": 8, "w": 10, "x": 0, "y": 13 },
      "id": 3,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": ["sum"],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT\n    concat('https://minotar.net/avatar/', p.name, '.png') as _,\n    p.name,\n    p.online,\n    extract(epoch from (NOW() AT TIME ZONE 'UTC' - up.last_join_time)) as \"online for\",\n    p.dim,\n    p.uuid\nFROM\n    players p\nLEFT JOIN\n    (\n        SELECT\n            uuid,\n            MAX(time) as last_join_time\n        FROM\n            userpresence\n        GROUP BY\n            uuid\n    ) up ON p.uuid = up.uuid\nWHERE\n    p.online = true AND ((array_position(ARRAY[$Players], NULL) is not NULL OR name = ANY(ARRAY[$Players])))\nLIMIT 50;\n",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [{ "name": "name", "type": "functionParameter" }],
                "type": "function"
              },
              {
                "parameters": [
                  { "name": "online", "type": "functionParameter" }
                ],
                "type": "function"
              },
              {
                "parameters": [{ "name": "dim", "type": "functionParameter" }],
                "type": "function"
              },
              {
                "parameters": [{ "name": "uuid", "type": "functionParameter" }],
                "type": "function"
              }
            ],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50,
            "whereJsonTree": {
              "children1": [
                {
                  "id": "9989b899-89ab-4cde-b012-31895e00156e",
                  "properties": {
                    "field": "online",
                    "operator": "equal",
                    "value": [true],
                    "valueSrc": ["value"],
                    "valueType": ["boolean"]
                  },
                  "type": "rule"
                }
              ],
              "id": "b8a88b9b-89ab-4cde-b012-31895df43d39",
              "type": "group"
            },
            "whereString": "online = true"
          },
          "table": "players"
        }
      ],
      "title": "Online Players",
      "transformations": [],
      "type": "table"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "fixedColor": "dark-blue", "mode": "palette-classic" },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "series",
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMin": 0,
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": { "legend": false, "tooltip": false, "viz": false },
            "lineInterpolation": "linear",
            "lineStyle": { "fill": "solid" },
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": { "type": "linear" },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": { "group": "A", "mode": "none" },
            "thresholdsStyle": { "mode": "off" }
          },
          "mappings": [],
          "thresholds": {
            "mode": "percentage",
            "steps": [{ "color": "dark-red", "value": null }]
          },
          "unit": "Chunks"
        },
        "overrides": []
      },
      "gridPos": { "h": 8, "w": 8, "x": 10, "y": 13 },
      "id": 4,
      "options": {
        "legend": {
          "calcs": ["lastNotNull"],
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "sortBy": "Last *",
          "sortDesc": true
        },
        "tooltip": { "mode": "single", "sort": "none" }
      },
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "time_series",
          "rawQuery": true,
          "rawSql": "SELECT\n  time_bucket('1 minute', time) AS time,\n  world,\n  AVG(value) AS \"average_value\"\nFROM\n  LoadedChunks\nWHERE\n  time > NOW() - interval '1 day' AND ((array_position(ARRAY[$Worlds], NULL) is not NULL OR world = ANY(ARRAY[$Worlds])))\nGROUP BY\n  time,\n  world\nORDER BY\n  time\n",
          "refId": "A",
          "sql": {
            "columns": [{ "parameters": [], "type": "function" }],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Loaded Chunks",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "Time": "",
              "average_value world": "Overworld",
              "average_value world_nether": "Nether",
              "average_value world_the_end": "The End"
            }
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "palette-classic" },
          "custom": {
            "hideFrom": { "legend": false, "tooltip": false, "viz": false }
          },
          "mappings": [],
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": { "h": 8, "w": 6, "x": 18, "y": 13 },
      "id": 9,
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": ["percent", "value"]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": ["allValues"],
          "fields": "",
          "values": true
        },
        "tooltip": { "mode": "single", "sort": "none" }
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "SELECT value AS metric, COUNT(*) AS value\nFROM commands\nWHERE $__timeFilter(time) AND ((array_position(ARRAY[$Worlds], NULL) is not NULL OR world = ANY(ARRAY[$Worlds])))\nGROUP BY value\n",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  { "name": "\"time\"", "type": "functionParameter" }
                ],
                "type": "function"
              },
              {
                "parameters": [
                  { "name": "value", "type": "functionParameter" }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              { "property": { "type": "string" }, "type": "groupBy" }
            ],
            "limit": 50
          },
          "table": "tps"
        }
      ],
      "title": "Commands",
      "type": "piechart"
    },
    {
      "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "palette-classic" },
          "custom": {
            "hideFrom": { "legend": false, "tooltip": false, "viz": false }
          },
          "mappings": [],
          "min": 50
        },
        "overrides": []
      },
      "gridPos": { "h": 7, "w": 8, "x": 10, "y": 21 },
      "id": 2,
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": ["value"]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": ["lastNotNull"],
          "fields": "",
          "values": false
        },
        "tooltip": { "mode": "single", "sort": "none" }
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
          "editorMode": "code",
          "format": "time_series",
          "rawQuery": true,
          "rawSql": "SELECT\n  time_bucket('1 month', time) AS time,\n  value,\n  world\nFROM\n  entitycounts \nWHERE\n  $__timeFilter(time) AND ((array_position(ARRAY[$Worlds], NULL) is not NULL OR world = ANY(ARRAY[$Worlds])))\n",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  { "name": "value", "type": "functionParameter" }
                ],
                "type": "function"
              },
              {
                "parameters": [
                  { "name": "\"time\"", "type": "functionParameter" }
                ],
                "type": "function"
              },
              {
                "parameters": [
                  { "name": "world", "type": "functionParameter" }
                ],
                "type": "function"
              }
            ],
            "groupBy": [],
            "limit": 50
          },
          "table": "entitycounts"
        }
      ],
      "title": "Entities",
      "transformations": [
        {
          "id": "extractFields",
          "options": {
            "format": "json",
            "jsonPaths": [],
            "keepTime": false,
            "replace": false,
            "source": "value"
          }
        }
      ],
      "type": "piechart"
    }
  ],
  "refresh": "",
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": "NULL",
        "current": {},
        "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
        "definition": "SELECT name FROM players ORDER BY last_seen DESC ",
        "description": "The name of the players you want to view",
        "hide": 0,
        "includeAll": true,
        "label": "",
        "multi": true,
        "name": "Players",
        "options": [],
        "query": "SELECT name FROM players ORDER BY last_seen DESC ",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "allValue": "NULL",
        "current": {},
        "datasource": { "type": "postgres", "uid": "${DS_POSTGRESQL}" },
        "definition": "SELECT distinct(world) FROM loadedchunks",
        "description": "The world you want to view stats of",
        "hide": 0,
        "includeAll": true,
        "multi": true,
        "name": "Worlds",
        "options": [],
        "query": "SELECT distinct(world) FROM loadedchunks",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "PostgreSQL",
          "value": "PostgreSQL"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "Datasource",
        "options": [],
        "query": "postgres",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  },
  "time": { "from": "now-3h", "to": "now" },
  "timepicker": { "hidden": false },
  "timezone": "",
  "title": "Minecraft Timeseries (V2)",
  "uid": "eee111b6-1c0f-47fb-be99-6bf5e44e6a85",
  "version": 8,
  "weekStart": ""
}
