You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+44-39
Original file line number
Diff line number
Diff line change
@@ -8,21 +8,25 @@
8
8
9
9
# Minecraft Prometheus Exporter
10
10
11
-
A **Bukkit plugin** which exports Minecraft server stats for Prometheus.
11
+
A **Bukkit plugin** to exports Minecraft server metrics to Prometheus.
12
+
13
+
Built for Paper, Spigot, Bukkit, Folia (experimental) and other forks.
12
14
13
15
If you're running multiple Minecraft servers behind a BungeeCord proxy, you might also be interested in [Bungeecord Prometheus Exporter](https://github.com/weihao/bungeecord-prometheus-exporter) for additional metrics!
14
16
15
17
## Quick Start
16
18
17
-
Drop the prometheus-exporter.jar into your Bukkit plugins directory and start your Minecraft server.
19
+
Copy the prometheus-exporter.jar into your Bukkit plugins directory and start your Minecraft server.
18
20
19
21
After startup, the Prometheus metrics endpoint should be available at ``localhost:9940/metrics`` (assuming localhost is the server hostname).
20
22
21
23
The metrics port can be customized in the plugin's config.yml (a default config will be created after the first use).
22
24
23
-
## Plugin config
25
+
## Installation & Configuration
26
+
27
+
### Plugin config
24
28
25
-
Here's a default config with annotations.
29
+
The default configuration file will be created after the first use of the plugin.
26
30
27
31
```yml
28
32
# Note that the HTTP server binds to localhost by default.
@@ -53,11 +57,11 @@ enable_metrics:
53
57
player_statistic: false
54
58
```
55
59
56
-
## Prometheus config
60
+
### Prometheus config
57
61
58
62
Add the following job to the ``scrape_configs`` section of your Prometheus configuration:
59
63
60
-
### Single server
64
+
#### Single server
61
65
62
66
```yml
63
67
- job_name: 'minecraft'
@@ -67,7 +71,7 @@ Add the following job to the ``scrape_configs`` section of your Prometheus confi
67
71
server_name: 'my-awesome-server'
68
72
```
69
73
70
-
### Multiple servers
74
+
#### Multiple servers
71
75
72
76
You can use labels in your Prometheus scrape configuration to distinguish between multiple servers:
73
77
@@ -82,16 +86,18 @@ You can use labels in your Prometheus scrape configuration to distinguish betwee
82
86
server_name: 'server2'
83
87
```
84
88
85
-
## Import Grafana Dashboard
89
+
### Import Grafana Dashboard
86
90
87
91
1. Navigate to Grafana -> Dashboards -> Import
88
92
1. Paste in or upload [minecraft-server-dashboard.json](https://raw.githubusercontent.com/sladkoff/minecraft-prometheus-exporter/master/dashboards/minecraft-server-dashboard.json)
89
93
1. Update "JVM Memory Used" to reflect your server max memory (Default 8G)
90
94
1. Edit (bottom right widget) -> Options -> Gauage -> Max
91
95
92
-
## Available metrics
96
+
You can also build your own dashboards using the metrics exported by the plugin. See [available metrics](#available-metrics) for a list of all the metrics exported by the plugin.
97
+
98
+
### Available metrics
93
99
94
-
These are the stats that are currently exported by the plugin.
@@ -110,7 +116,7 @@ These are the stats that are currently exported by the plugin.
110
116
| mc_tick_duration_min | Min Tick Duration (ns, usually last 100 ticks) | ❌ |
111
117
| mc_tick_duration_max | Max Tick Duration (ns, usually last 100 ticks) | ❌ |
112
118
113
-
## Player metrics (experimental!)
119
+
### Player metrics (experimental!)
114
120
115
121
:warning: **The following feature is against Prometheus best-practices and is not recommended for production servers!**
116
122
@@ -136,18 +142,38 @@ This will enable the additional metrics.
136
142
| mc_player_statistic | Player statistics | ❌ |
137
143
| mc_player_online | Online state by player name | ❌ |
138
144
139
-
There's a sample [dashboard](https://raw.githubusercontent.com/sladkoff/minecraft-prometheus-exporter/master/dashboards/minecraft-players-dashboard.json)
140
-
available to get you started.
145
+
There's an additional sample [Grafana dashboard](https://raw.githubusercontent.com/sladkoff/minecraft-prometheus-exporter/master/dashboards/minecraft-players-dashboard.json)
146
+
with player statistics enabled to get you started.
141
147
142
148
You can find the full list [here](https://minecraft.fandom.com/wiki/Statistics#List_of_custom_statistic_names).
143
149
Use the "Resource location" for the metrics label with removing the "minecraft:" part and converted to uppercase.
144
150
This doesn't support all statistics in the list because they are provided by the upstream Spigot libraries.
145
151
146
-
## Collect metrics about your own plugin
152
+
### Compatibility
153
+
154
+
| Plugin version | Min Minecraft version | Min Java version |
– Java 17 is required for the latest version of the plugin.
162
+
- There is a known [issue](https://github.com/sladkoff/minecraft-prometheus-exporter/issues/197) with Azul JVM.
163
+
- There is currently rudimentary support for Folia servers. Only selected metrics are supported.
164
+
- The plugin has been tested recently on
165
+
- Minecraft 1.20.1
166
+
- Minecraft 1.20.4
167
+
168
+
## Plugin Integration
169
+
170
+
By integrating your own plugin with the Minecraft Prometheus Exporter, you can **monitor your plugin**: Collect metrics about your plugin's performance or usage.
171
+
172
+
### Collect metrics about your own plugin
147
173
148
174
You can easily collect metrics about your own plugin.
149
175
150
-
### Include the Prometheus dependency
176
+
#### Include the Prometheus dependency
151
177
152
178
```xml
153
179
<dependency>
@@ -157,9 +183,9 @@ You can easily collect metrics about your own plugin.
157
183
</dependency>
158
184
```
159
185
160
-
### Collect metrics
186
+
####Collect metrics
161
187
162
-
This pseudo code shows how you would count invocations of a plugin command.
188
+
This pseudocode shows how you would count invocations of a plugin command.
163
189
164
190
```java
165
191
publicclassMyPluginCommandextendsPluginCommand {
@@ -171,7 +197,7 @@ public class MyPluginCommand extends PluginCommand {
171
197
.register();
172
198
173
199
@Override
174
-
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
0 commit comments