跳到正文

Spark REST

作者:JonayKB

创建 REST 接口,通过 Spark 展示指标。

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Spark-REST

Spark-REST is a lightweight Minecraft Forge 1.20.1 mod that exposes server performance metrics — provided by the Spark profiler — through a simple REST API.
Designed for server administrators who want to monitor TPS, MSPT, CPU usage, and other performance data using external dashboards, bots, or monitoring tools.


🚀 Features

  • Built-in HTTP server that exposes live performance metrics
  • Retrieves data directly from Spark
  • Metrics include: TPS (10s, 1m, 5m, 15m), MSPT, CPU usage, etc…
  • Fully configurable port and endpoint
  • Extremely lightweight and safe for production servers

📦 Requirements

  • Minecraft Forge 1.20.1
  • Spark profiler installed on the server (created by Lucko)
  • Java 17 or higher

Note: Spark-REST does not include Spark. You must install Spark separately.


⚙️ Installation

  1. Download spark-rest.jar
  2. Place it in your server’s /mods/ folder
  3. Ensure the Spark mod is also installed
  4. Start the server to generate the configuration file

📝 Configuration

  • After the first launch, the configuration file is created at:
  • config/spark_rest-common.toml
  • Example:
    • [general]
      port = 8080
      endpoint = "metrics"
      enabled = true

🔗 REST API

  • Access your metrics from any browser, bot, or dashboard:
  • http://{server-ip}:{port}/{endpoint};
  • Example:
  • http://localhost:8080/metrics
  • Example JSON response:
    • > { “tps_10s”: 20.0, “tps_1m”: 19.95, “tps_5m”: 19.87, “tps_15m”: 19.76, “mspt_1m”: 12.4, “cpu”: 45.2 }

❓FAQ

  • Spark-REST returns no metrics or errors
            Make sure Spark is installed and running — Spark-REST depends on Spark’s API.
  • The port is already in use
            Change the port value in the config file.

👤 Author


🙌 Credits

  • This mod is powered by performance data provided by the Spark profiler, created by Lucko.
    Spark-REST is not affiliated with the original Spark project but depends on its API to function.

📜 License


常见问题

Spark REST 支持哪些 Minecraft 版本?

Spark REST 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

Spark REST 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分