Grafana dashboard: Main-Server
Description: 主面板！


{
  "__inputs": [
    {
      "name": "DS_INFLUXDB-MCSERVER",
      "label": "influxdb-mcserver",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar Gauge",
      "version": ""
    },
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.7.1"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    },
    {
      "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": 12018,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1585577002376,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "links": [],
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "defaults": {
            "mappings": [
              {
                "id": 0,
                "op": "=",
                "text": "N/A",
                "type": 1,
                "value": "null"
              }
            ],
            "nullValueMode": "connected",
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green",
                  "value": null
                },
                {
                  "color": "red",
                  "value": 80
                }
              ]
            },
            "title": "服务器运行时长",
            "unit": "none"
          },
          "overrides": [],
          "values": false
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "pluginVersion": "6.7.1",
      "targets": [
        {
          "groupBy": [],
          "measurement": "server",
          "orderByTime": "ASC",
          "policy": "autogen",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "serveruptime"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "time"
            },
            {
              "condition": "AND",
              "key": "time",
              "operator": ">",
              "value": "now()-1m"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "type": "stat"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorPostfix": false,
      "colorPrefix": false,
      "colorValue": true,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "decimals": 0,
      "format": "short",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 4,
        "y": 0
      },
      "id": 4,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.6.2",
      "postfix": " / $max_player",
      "postfixFontSize": "70%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": true,
        "ymax": null,
        "ymin": 0
      },
      "tableColumn": "",
      "targets": [
        {
          "groupBy": [],
          "measurement": "player",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT \"total\", \"max\"::tag FROM \"autogen\".\"player\" WHERE (\"type\" = 'p_count') AND $timeFilter ORDER BY time DESC",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "total"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "p_count"
            },
            {
              "condition": "AND",
              "key": "time",
              "operator": ">",
              "value": "now()-1m"
            }
          ]
        }
      ],
      "thresholds": "$max_player",
      "timeFrom": null,
      "timeShift": null,
      "title": "当前玩家数量",
      "type": "singlestat",
      "valueFontSize": "120%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "gridPos": {
        "h": 4,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 12,
      "links": [],
      "options": {
        "displayMode": "lcd",
        "fieldOptions": {
          "calcs": [
            "mean"
          ],
          "defaults": {
            "decimals": 1,
            "mappings": [],
            "max": 1,
            "min": 0,
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green",
                  "value": null
                },
                {
                  "color": "#EAB839",
                  "value": 0.5
                },
                {
                  "color": "red",
                  "value": 0.8
                }
              ]
            },
            "title": "",
            "unit": "percentunit"
          },
          "overrides": [],
          "values": false
        },
        "orientation": "horizontal",
        "showUnfilled": true
      },
      "pluginVersion": "6.7.1",
      "targets": [
        {
          "alias": "$col",
          "groupBy": [],
          "measurement": "server",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT /cpu*/ FROM \"autogen\".\"server\" WHERE (\"type\" = 'cpu') AND $timeFilter AND time > now() -1m",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "/cpu*/"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "cpu"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "平均CPU使用率",
      "type": "bargauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "fill": 10,
      "fillGradient": 10,
      "gridPos": {
        "h": 6,
        "w": 12,
        "x": 0,
        "y": 4
      },
      "hiddenSeries": false,
      "id": 10,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "hideEmpty": false,
        "hideZero": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": false,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 2,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "TPS",
          "groupBy": [],
          "measurement": "server",
          "orderByTime": "ASC",
          "policy": "autogen",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "tps"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "tps"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "TPS",
      "tooltip": {
        "shared": true,
        "sort": 2,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 1,
          "format": "short",
          "label": "TPS",
          "logBase": 1,
          "max": "20",
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 12,
        "y": 4
      },
      "hideTimeOverride": false,
      "id": 6,
      "interval": "1m",
      "options": {
        "fieldOptions": {
          "calcs": [
            "mean"
          ],
          "defaults": {
            "decimals": 2,
            "mappings": [],
            "max": 20,
            "min": 0,
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "dark-red",
                  "value": null
                },
                {
                  "color": "#EAB839",
                  "value": 5
                },
                {
                  "color": "green",
                  "value": 14
                }
              ]
            },
            "title": "当前时段平均TPS",
            "unit": "short"
          },
          "overrides": [],
          "values": false
        },
        "orientation": "auto",
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "6.7.1",
      "targets": [
        {
          "groupBy": [],
          "limit": "",
          "measurement": "server",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT mean(\"tps\") FROM \"autogen\".\"server\" WHERE (\"type\" = 'tps' AND \"time\" > $timefilter) AND $timeFilter GROUP BY time(30s)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "tps"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "tps"
            },
            {
              "condition": "AND",
              "key": "time",
              "operator": ">",
              "value": "now()-1m"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "type": "gauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "decimals": 1,
      "fill": 2,
      "fillGradient": 5,
      "gridPos": {
        "h": 6,
        "w": 8,
        "x": 16,
        "y": 4
      },
      "hiddenSeries": false,
      "id": 16,
      "interval": "",
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "hideEmpty": true,
        "hideZero": true,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
        {
          "alias": "$col",
          "groupBy": [],
          "measurement": "server",
          "orderByTime": "ASC",
          "policy": "autogen",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "*"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "cpu"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "CPU使用率记录",
      "tooltip": {
        "shared": true,
        "sort": 2,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 1,
          "format": "percentunit",
          "label": "使用率",
          "logBase": 1,
          "max": "1",
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "decimals": 2,
      "fill": 1,
      "fillGradient": 10,
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 10
      },
      "hiddenSeries": false,
      "id": 14,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "分配的最高占用",
          "color": "#C4162A",
          "fill": 0,
          "fillGradient": 0,
          "legend": false,
          "linewidth": 1
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "",
          "groupBy": [],
          "measurement": "server",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT \"memory_total\" AS \"占用内存\", \"memory_free\" AS \"空闲内存\" FROM \"autogen\".\"server\" WHERE (\"type\" = 'memory') AND $timeFilter",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "memory_total"
                ],
                "type": "field"
              },
              {
                "params": [
                  "占用内存"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "memory_free"
                ],
                "type": "field"
              },
              {
                "params": [
                  "空闲内存"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "memory_max"
                ],
                "type": "field"
              },
              {
                "params": [
                  "分配的最高占用"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "memory"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "内存占用",
      "tooltip": {
        "shared": true,
        "sort": 2,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "decmbytes",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": "0",
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 12,
        "y": 10
      },
      "id": 8,
      "links": [],
      "options": {
        "fieldOptions": {
          "calcs": [
            "mean"
          ],
          "defaults": {
            "decimals": 2,
            "mappings": [
              {
                "id": 0,
                "op": "=",
                "text": "N/A",
                "type": 1,
                "value": "null"
              }
            ],
            "max": 100,
            "min": 0,
            "nullValueMode": "connected",
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green",
                  "value": null
                },
                {
                  "color": "dark-yellow",
                  "value": 75
                },
                {
                  "color": "red",
                  "value": 90
                }
              ]
            },
            "title": "内存使用占比",
            "unit": "percent"
          },
          "overrides": [],
          "values": false
        },
        "orientation": "horizontal",
        "showThresholdLabels": true,
        "showThresholdMarkers": true
      },
      "pluginVersion": "6.7.1",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "type"
              ],
              "type": "tag"
            }
          ],
          "measurement": "server",
          "orderByTime": "ASC",
          "policy": "autogen",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "memory_percent"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              },
              {
                "params": [
                  " * 100"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "memory"
            },
            {
              "condition": "AND",
              "key": "time",
              "operator": ">",
              "value": "now() - 1m"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "",
      "type": "gauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "decimals": 0,
      "fill": 1,
      "fillGradient": 10,
      "gridPos": {
        "h": 7,
        "w": 8,
        "x": 16,
        "y": 10
      },
      "hiddenSeries": false,
      "id": 20,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "$tag_world_name",
          "groupBy": [
            {
              "params": [
                "world_name"
              ],
              "type": "tag"
            }
          ],
          "measurement": "world",
          "orderByTime": "ASC",
          "policy": "autogen",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "entity_count"
                ],
                "type": "field"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "entity_count"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "实体数量",
      "tooltip": {
        "shared": true,
        "sort": 2,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 0,
          "format": "short",
          "label": "数量",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "datasource": "${DS_INFLUXDB-MCSERVER}",
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 17
      },
      "id": 18,
      "links": [],
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "defaults": {
            "decimals": 0,
            "mappings": [
              {
                "id": 0,
                "op": "=",
                "text": "N/A",
                "type": 1,
                "value": "null"
              }
            ],
            "min": 0,
            "nullValueMode": "connected",
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "blue",
                  "value": null
                },
                {
                  "color": "green",
                  "value": null
                },
                {
                  "color": "yellow"
                },
                {
                  "color": "red",
                  "value": 1000
                }
              ]
            },
            "title": "",
            "unit": "short"
          },
          "overrides": [],
          "values": false
        },
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "vertical"
      },
      "pluginVersion": "6.7.1",
      "targets": [
        {
          "alias": "$tag_world_name",
          "groupBy": [
            {
              "params": [
                "world_name"
              ],
              "type": "tag"
            }
          ],
          "measurement": "world",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"chunk_count\") FROM \"autogen\".\"world\" WHERE (\"type\" = 'chunk_count') AND $timeFilter",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "chunk_count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "type",
              "operator": "=",
              "value": "chunk_count"
            },
            {
              "condition": "AND",
              "key": "time",
              "operator": ">",
              "value": "now()-1m"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "加载区块数量",
      "type": "stat"
    }
  ],
  "refresh": "5s",
  "schemaVersion": 22,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_INFLUXDB-MCSERVER}",
        "definition": "SELECT \"max\" FROM \"mcserver\".\"autogen\".\"player\" WHERE time>now()-1m ORDER BY time DESC limit 1",
        "hide": 2,
        "includeAll": false,
        "index": -1,
        "label": "最大玩家数量",
        "multi": false,
        "name": "max_player",
        "options": [],
        "query": "SELECT \"max\" FROM \"mcserver\".\"autogen\".\"player\" WHERE time>now()-1m ORDER BY time DESC limit 1",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Main-Server",
  "uid": "tRpHIY9Wz",
  "variables": {
    "list": []
  },
  "version": 51,
  "description": "主面板！"
}