FabricExporter
一个 Fabric 模组,为服务器添加带有常规指标的 Prometheus 导出器。
这是一个服务端模组,以 Prometheus 格式暴露你的 Fabric 服务器的指标。 因此,你需要至少安装了 Prometheus 来收集提供的指标。 我也推荐使用 Grafana 来可视化数据。
如果你想获取 TPS 和 MSPT 指标,你还应该为你的 Fabric 服务器安装 Spark 作为模组。
暴露的指标
以下是 FabricExporter 收集的指标列表。
- Minecraft 收集的指标不需要额外配置,但在旧版 Minecraft 上运行时可能会导致错误
- Spark 收集的指标需要安装 Spark
你可以在 配置文件 中禁用任何这些指标。
| Prometheus name | Description | Config property | Collected by |
|---|---|---|---|
minecraft_loaded_chunks |
服务器上当前加载的区块数量 | enable-loaded-chunks |
Minecraft |
minecraft_total_loaded_chunks |
服务器上总共加载的区块数量 | enable-total-loaded-chunks |
Minecraft |
minecraft_mspt |
每个刻的毫秒数 (MSPT) | enable-mspt |
Spark |
minecraft_tps |
每秒刻数 (TPS) | enable-tps |
Spark |
minecraft_players_online |
服务器上当前在线的玩家数量 | enable-players-online |
FabricExporter |
minecraft_entities |
服务器上当前加载的实体数量 | enable-entities |
FabricExporter |
minecraft_handshakes |
握手请求计数 | enable-handshakes |
FabricExporter |
入门指南
要使用此模组,你至少需要安装 Fabric 服务器和 Prometheus。
安装模组
- 从 Releases 页面下载模组。
- 将下载的模组 jar 文件放入
mods文件夹。 - 启动服务器以生成配置文件。
- 打开
config/exporter.properties,确保server-port的值是一个可以被你的 Prometheus 访问的开放端口,并根据需要更改它。 - 如果修改了配置文件,请重启服务器。
配置 Prometheus
- 打开你的 Prometheus 配置文件(默认位于
/etc/prometheus/prometheus.yml)。
sudo nano /etc/prometheus/prometheus.yml
- 在
scrape_configs部分添加 FabricExporter 端点。 别忘了将127.0.0.1替换为你服务器的地址,并将25585替换为exporter.properties文件中server-port属性指定的端口。
- job_name: 'fabric'
static_configs:
- targets: ['127.0.0.1:25585']
- 重启 Prometheus 服务。
sudo service prometheus restart
导入 Grafana 仪表板
如果你想使用 Grafana,你可以使用我的仪表板作为模板。 我假设你已经在 Grafana 中 创建了 Prometheus 数据源。 那么,让我们导入 FabricExporter 的仪表板。
- 登录到你的 Grafana 并进入
Create -> Import选项卡。 - 在 "Import via grafana.com" 字段中输入
14492并点击 "Load"。 - 在下一页根据需要更改设置并点击 "Import"。
配置
服务器启动后,FabricExporter 将在 config 文件夹中创建 exporter.properties 文件。
你应该使用此文件来配置模组。
在此文件中,你可以看到一些常规设置和指标设置。
常规设置
| Property | Description | Default value |
|---|---|---|
server-port |
Web 服务器监听请求的端口 | 25585 |
update-interval |
仪表盘指标更新之间的间隔(毫秒) | 1000 |
use-spark |
如果设置为 false,FabricExporter 将独立于 Spark |
true |
指标设置
你可以使用 exporter.properties 文件禁用通过 MetricRegistry 注册的任何指标(默认情况下全部启用)。
属性名称由 enable 和指标名称组成,其中前缀被移除且 _ 被替换为 -。
例如,如果你想禁用 minecraft_players_online,你应该将 enable-players-online 设置为 false。
你也可以在“暴露的指标”部分查看可用属性列表。
如果你找不到某些指标的对应属性,可以手动添加。
所有指标默认均为启用状态。
许可证
MIT 许可证。更多信息请参阅 LICENSE
FabricExporter
Fabric mod that adds a Prometheus exporter with general metrics of your server.
It's a server-side mod that exposes metrics of your Fabric server in Prometheus format. So, it requires you to have at least Prometheus installed to collect provided metrics. I recommend also using Grafana to visualize data.
If you want to get TPS and MSPT metrics, you should also install Spark as mod for your Fabric server.
Exposed metrics
Here is a list of metrics that are collected by FabricExporter.
- Metrics collected by Minecraft doesn't require anything, but may cause errors when running on old Minecraft versions
- Metrics collected by Spark require Spark to be installed
You can disable any of these metrics in config.
| Prometheus name | Description | Config property | Collected by |
|---|---|---|---|
minecraft_loaded_chunks |
Amount of currently loaded chunks on server | enable-loaded-chunks |
Minecraft |
minecraft_total_loaded_chunks |
Amount of total loaded chunks on server | enable-total-loaded-chunks |
Minecraft |
minecraft_mspt |
Count of milliseconds per tick (MSPT) | enable-mspt |
Spark |
minecraft_tps |
Count of ticks per second (TPS) | enable-tps |
Spark |
minecraft_players_online |
Amount of currently online players on your server | enable-players-online |
FabricExporter |
minecraft_entities |
Amount of currently loaded entities on your server | enable-entities |
FabricExporter |
minecraft_handshakes |
Count of handshake requests | enable-handshakes |
FabricExporter |
Getting started
To use this mod you should have at least Fabric server and Prometheus installed.
Installing mod
- Download the mod from Releases page.
- Drop downloaded mod jar to the
modsfolder. - Start your server to generate config file.
- Open
config/exporter.properties, ensure thatserver-portvalue is an open port that can be accessed by your Prometheus and change it if required. - Restart the server if you made changes in config.
Configuring Prometheus
- Open your Prometheus config file (it located at
/etc/prometheus/prometheus.ymlby default).
sudo nano /etc/prometheus/prometheus.yml
- Add FabricExporter endpoint to the
scrape_configssection. Don't forget to replace127.0.0.1with address of your server and25585with port specified inserver-portproperty inexporter.propertiesfile.
- job_name: 'fabric'
static_configs:
- targets: ['127.0.0.1:25585']
- Restart Prometheus service.
sudo service prometheus restart
Importing Grafana dashboard
If you want to use Grafana, you can use my dashboard as template. I assume that you have already created a Prometheus data source in Grafana. So, let's import dashboard for FabricExporter.
- Log in to your Grafana and go to
Create -> Importtab. - Type
14492in "Import via grafana.com" field and click "Load". - On the next page change settings as you wish and click "Import".
Configuring
After your server starts, FabricExporter will create exporter.properties file in the config folder.
You should use this file to configure the mod.
In this file you can see some general settings and metrics settings.
General settings
| Property | Description | Default value |
|---|---|---|
server-port |
Port on what the web server will listen for requests | 25585 |
update-interval |
Interval between gauge metrics updates in milliseconds | 1000 |
use-spark |
If set to false, FabricExporter will be independent from Spark |
true |
Metrics settings
You can disable any metric that registered via MetricRegistry (all metrics by default) using exporter.properties file.
Names of properties consist of enable and metric name without prefix and _ replaced with -.
For example, if you want to disable minecraft_players_online, you should set enable-players-online to false.
You can also see list of available properties in "Exposed metrics" section.
If you can't find property for some metrics, you can manually add it.
All metrics are enabled by default.
License
MIT license. Read more in LICENSE
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
下载 FabricExporter
- 优化 Modrinth 发布工作流
- 提升版本号
- 更新至 26.3
- 在每次更新前清除按世界划分的仪表盘,以移除过时的维度系列
未指定更新日志。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧