Code Monkey home page Code Monkey logo

minecraft-prometheus-exporter's Introduction

Minecraft Prometheus Exporter

A Bukkit plugin to exports Minecraft server metrics to Prometheus.

Built for Paper, Spigot, Bukkit, Folia (experimental) and other forks.

If you're running multiple Minecraft servers behind a BungeeCord proxy, you might also be interested in Bungeecord Prometheus Exporter for additional metrics!

Quick Start

Copy the prometheus-exporter.jar into your Bukkit plugins directory and start your Minecraft server.

After startup, the Prometheus metrics endpoint should be available at localhost:9940/metrics (assuming localhost is the server hostname).

The metrics port can be customized in the plugin's config.yml (a default config will be created after the first use).

Feature Overview

Prometheus Exporter

The plugin exports a variety of metrics about your Minecraft server to Prometheus. These metrics can be used to monitor the health and performance of your server.

The metrics are exposed at localhost:9940/metrics by default. See the rest of the README for more information on how to configure Prometheus to scrape these metrics.

Custom Health Checks

The plugin can be configured to perform custom health checks on your server. These checks can be used to monitor the health of your server and alert you if something goes wrong.

The aggregated health checks are exposed at localhost:9940/health by default.

See Health Checks for more information on how to build your own health checks in your plugins.

Installation & Configuration

Plugin config

The default configuration file will be created after the first use of the plugin.

# Note that the HTTP server binds to localhost by default.
# If your Prometheus runs on another host or inside a Kubernetes cluster
# set this to any reachable IP or 0.0.0.0 to listen on all interfaces.
host: localhost
# The port can be changed in case it conflicts with any other application.
port: 9940
# Metrics can be enabled individually. Metrics which are disabled
# by default may have a performance impact on your server.
# See the rest of the README for more information.
enable_metrics:
  jvm_threads: true
  jvm_gc: true
  players_total: true
  whitelisted_players: true
  entities_total: true
  living_entities_total: true
  loaded_chunks_total: true
  jvm_memory: true
  players_online_total: true
  tps: true
  tick_duration_average: true
  tick_duration_median: true
  tick_duration_min: false
  tick_duration_max: true
  player_online: false
  player_statistic: false

Prometheus config

Add the following job to the scrape_configs section of your Prometheus configuration:

Single server

- job_name: 'minecraft'
  static_configs:
    - targets: ['localhost:9940']
      labels:
        server_name: 'my-awesome-server'

Multiple servers

You can use labels in your Prometheus scrape configuration to distinguish between multiple servers:

- job_name: 'minecraft'
  static_configs:
    - targets: ['localhost:9940']
      labels:
        server_name: 'server1'
    - targets: ['localhost:9939']
      labels:
        server_name: 'server2'

Import Grafana Dashboard

  1. Navigate to Grafana -> Dashboards -> Import
  2. Paste in or upload minecraft-server-dashboard.json
  3. Update "JVM Memory Used" to reflect your server max memory (Default 8G)
  4. Edit (bottom right widget) -> Options -> Gauage -> Max

You can also build your own dashboards using the metrics exported by the plugin. See available metrics for a list of all the metrics exported by the plugin.

Available metrics

The following metrics are exported by the plugin:

Label Description Folia Support
mc_players_total Unique players on server (online + offline)
mc_whitelisted_players Players count on the white list
mc_loaded_chunks_total Chunks loaded per world
mc_players_online_total Online players per world
mc_entities_total Entities loaded per world (living + non-living)
mc_villagers_total Villagers
mc_world_size World size in bytes
mc_jvm_memory JVM memory usage
mc_jvm_threads JVM threads info
mc_tps Server tickrate (TPS)
mc_tick_duration_median Median Tick Duration (ns, usually last 100 ticks)
mc_tick_duration_average Average Tick Duration (ns, usually last 100 ticks)
mc_tick_duration_min Min Tick Duration (ns, usually last 100 ticks)
mc_tick_duration_max Max Tick Duration (ns, usually last 100 ticks)

Player metrics

Warning

The following feature is against Prometheus best-practices and is not recommended for production servers.

There is an option to export per-player statistics like the number of blocks mined, mobs killed, items used, etc. The amount of data stored in Prometheus can dramatically increase when this is enabled as individual time-series will be generated for each player that has ever been seen on the server. The statistic collection may also have an impact on the Minecraft server performance for bigger servers but it has not been measured or tested.

On the other hand this should be quite safe for small private servers with limited players.

You can enable the experimental player export in the config.yaml.

enable_metrics:
  player_online: true
  player_statistic: true

This will enable the additional metrics.

Label Description Folia
mc_player_statistic Player statistics
mc_player_online Online state by player name

There's an additional sample Grafana dashboard with player statistics enabled to get you started.

You can find the full list here. Use the "Resource location" for the metrics label with removing the "minecraft:" part and converted to uppercase. This doesn't support all statistics in the list because they are provided by the upstream Spigot libraries.

Compatibility

Plugin version Min Minecraft version Min Java version
3.x.x 1.17.1 17
1.0.0 - 2.x.x 1.11.x 11

Notes

  • Java 17 is required for the latest version of the plugin.
  • There is a known issue with Azul JVM.
  • There is currently rudimentary support for Folia servers. Only selected metrics are supported.
  • The plugin has been tested recently on
    • Minecraft 1.20.1
    • Minecraft 1.20.4

Plugin Integration

By integrating your own plugin with the Minecraft Prometheus Exporter, you can:

  1. Monitor your plugin's performance: Collect metrics about your plugin's performance and resource usage.
  2. Provide custom health checks: Monitor the health of your plugin and alert you if something goes wrong.

Collect metrics about your own plugin

You can easily collect metrics about your own plugin.

Include the Prometheus dependency

<dependency>
    <groupId>io.prometheus</groupId>
    <artifactId>simpleclient_common</artifactId>
    <version>...</version>
</dependency>

Collect metrics

This pseudocode shows how you would count invocations of a plugin command.

public class MyPluginCommand extends PluginCommand {

  // Register your counter
  private Counter commandCounter = Counter.build()
            .name("mc_my_plugin_command_invocations_total")
            .help("Counter for my plugin command invocations")
            .register();

  @Override
  public boolean execute(CommandSender sender, String commandLabel, String[] args) {

    // Increment your counter;
    commandCounter.inc();

    // Do other stuff

    return true;
  }

}

Provide a health check from your own plugin

You can easily collect metrics about your own plugin.

Add compile-time dependency to your plugin

  1. Get the latest minecraft-prometheus-exporter-3.0.0.jar from the releases page.
  2. Add the jar to your project's classpath.

Create a health check

Create your custom health check by extending the HealthCheck class.

public class CustomHealthCheck implements HealthCheck {
    @Override
    public boolean isHealthy() {
        return true; // Your custom health check logic
    }
}

Register the health check

Register your health check in your plugin's onEnable method or similar.

This will add your health check to the list of health checks that are aggregated and exposed by the Minecraft Prometheus Exporter

public class MyPlugin extends JavaPlugin {

    @Override
    public void onEnable() {
      // Register your health check
      getServer().servicesManager.load(HealthChecks.class).add(new CustomHealthCheck());
    }
}

minecraft-prometheus-exporter's People

Contributors

3nt3 avatar asemy avatar combustible avatar darnfish avatar dependabot[bot] avatar eruizc-dev avatar fishzle avatar galexrt avatar jarviscraft avatar lfuelling avatar lhridder avatar libook avatar marvinklar avatar nkomarn avatar phaldan avatar phemmer avatar radiant-ai avatar renovate-bot avatar renovate[bot] avatar saiv46 avatar schoentoon avatar sladkoff avatar strum355 avatar weihao avatar zaquestion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minecraft-prometheus-exporter's Issues

Host configuration suggestion

Great repo! I got everything up and running on my raspberry pi kubernetes cluster. Pretty cool.

One thing that took some time to figure out was the config.yaml configuration for host. As I run this in kubernetes I have no way of knowing before hand what IP or Host I am getting so I had to read up on the Jetty configuration for starting the server. Turns out that if I set it to 0.0.0.0 I can have promtheus scrape the endpoint succesfully, but with localhost it is not getting through.

A suggestion would be to change the default of localhost to 0.0.0.0 as that will be more permissive for anyone running the plugin. If not, maybe add an entry under quickstart that using 0.0.0.0 will be ideal when running minecraft containerized.

[Feature Request] Time per tick (NOT TPS)

Describe the solution you'd like
Obtain a metric for time per tick.

Describe alternatives you've considered
This is not the same as ticks per second. As TPS has an upper bound of 20, it does not give you enough resolution to monitor the performance in detail. In fact, by using TPS, you can only detect performance issues once TPS starts to drop, and by then it's impacting your clients. The intent of measuring time per tick is to detect when server performance is approaching the threshold upon which it will impact your clients.

Additional context
The caveat is obtaining this metric. If using Paper, then obtaining it is actually easy as Paper exposes these metrics: https://papermc.io/javadocs/paper/1.15/org/bukkit/Server.html#getTickTimes--
...which they use for the /mspt command:

> mspt
[23:53:56 INFO]: Server tick times (avg/min/max) from last 5s, 10s, 1m:
[23:53:56 INFO]: ◴ 2.6/1.5/10.1, 2.6/1.5/10.1, 2.6/1.4/10.1

However if using spigot, then it's not quite so simple. I found this post https://www.spigotmc.org/threads/get-ms-tick-of-server.428642/, so maybe some reflection could be used to pull the data. Certainly not pretty.

Error after install

Getting this after I install https://i.imgur.com/BtYPUPj.png I added

- job_name: 'minecraft' scrape_interval: 5s static_configs: - targets: ['localhost:9225']

to /etc/prometheus/prometheus.yml and restarted prometheus but still nothing

tcp6 0 0 127.0.0.1:9225 :::* LISTEN 9898/java

Edit: Updated to latest vesion on github and I get this now https://i.imgur.com/v19SwwK.png

Edit2: Guess you can ignore all this. I installed grafana and it filled all the dashboards. only thing is seems the TPS reading is way off?

[Question] Got the plugin and prometheus going but- it seems the data comes incorrect

  • [✅] I have successfully configured Prometheus
  • [✅] I have successfully configured Grafana
  • [✅] I have added a valid scrape config for my Minecraft server in Prometheus
  • [✅] I know how to build Grafana dashboards and Prometheus queries

Have a look at the screenshot. Running 1.16.4 PaperMC with the latest plugin version from SpigotMC
The data that comes into Grafana does not seem correct, take a look:

image

The two metrics that are off are Player count and TPS. Any idea on a remedy?

Thanks.

Stuck when stopping server

Part of the logs:

[11:04:01 INFO]: [ClearChat] Disabling ClearChat v3.0.1
[11:04:01 INFO]: [KeepItems] Disabling KeepItems v1.3.2
[11:04:01 INFO]: [PrometheusExporter] Disabling PrometheusExporter v1.1.0
[11:04:01 WARN]: 2017-06-17 11:04:01.354:INFO:oejs.AbstractConnector:Server thread: Stopped ServerConnector@1429aebf{HTTP/1.1,[http/1.1]}{0.0.0.0:9225}

(stuck here for 15 sec)

[11:04:16 WARN]: [PrometheusExporter] Failed to read server statistics
[11:04:16 WARN]: java.lang.InterruptedException
[11:04:16 WARN]: 	at java.lang.Object.wait(Native Method)
[11:04:16 WARN]: 	at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftFuture.get(CraftFuture.java:54)
[11:04:16 WARN]: 	at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftFuture.get(CraftFuture.java:42)
[11:04:16 WARN]: 	at de.sldk.mc.MetricsController.handle(MetricsController.java:68)
[11:04:16 WARN]: 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
[11:04:16 WARN]: 	at org.eclipse.jetty.server.Server.handle(Server.java:564)
[11:04:16 WARN]: 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
[11:04:16 WARN]: 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
[11:04:16 WARN]: 	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
[11:04:16 WARN]: 	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
[11:04:16 WARN]: 	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
[11:04:16 WARN]: 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
[11:04:16 WARN]: 	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
[11:04:16 WARN]: 	at java.lang.Thread.run(Thread.java:748)
[11:04:16 INFO]: Saving players
[11:04:16 INFO]: Saving worlds
[11:04:16 INFO]: Saving chunks for level 'sb1_spawn'/Overworld
[11:04:16 INFO]: Saving chunks for level 'Skyblock1'/Overworld
[11:04:16 INFO]: Saving chunks for level 'Skyblock1_nether'/Nether

[Bug Report] Entities counter is inaccurate

Read before opening a bug report!

First, please ensure that you have done the following things on your own.

  • [V ] I have successfully configured Prometheus
  • [V] I have successfully configured Grafana
  • [V] I have added a valid scrape config for my Minecraft server in Prometheus
  • [kinda] I know how to build Grafana dashboards and Prometheus queries

I've found a bug that if all entities disappear from a world, it does not update their counter on grafana, they keep being for example "14" instead of going to 0 (pretty much it never reaches 0) I'm not sure if it's a configuration issue on my side or a bug in the plugin

Prometheus keeps crashing when i add the minecraft Job

Read before opening a question!

First, please ensure that you have done the following things on your own.

  • I have successfully configured Prometheus
  • I have successfully configured Grafana
  • I have added a valid scrape config for my Minecraft server in Prometheus
  • I know how to build Grafana dashboards and Prometheus queries

These steps are out of the scope of this issue tracker. If you have questions about any of these steps, please refer to the respective documentations:

[Bug Report] Entities metric throws exceptions for server versions < 1.14

Hello,

I have installed the exporter jar onto some of my servers and I'm getting the below stack error whenever the dashboard refreshes.

[12:11:29 WARN]: [PrometheusExporter] Task #33056 for PrometheusExporter v2.1.0 generated an exception
java.lang.NoSuchMethodError: org.bukkit.entity.EntityType.getKey()Lorg/bukkit/NamespacedKey;
        at de.sldk.mc.metrics.Entities.getEntityName(Entities.java:60) ~[?:?]
        at de.sldk.mc.metrics.Entities.lambda$collect$0(Entities.java:51) ~[?:?]
        at java.util.HashMap$KeySet.forEach(HashMap.java:933) ~[?:1.8.0_191]
        at de.sldk.mc.metrics.Entities.collect(Entities.java:48) ~[?:?]
        at de.sldk.mc.metrics.WorldMetric.doCollect(WorldMetric.java:17) ~[?:?]
        at de.sldk.mc.metrics.Metric.collect(Metric.java:27) ~[?:?]
        at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_191]
        at de.sldk.mc.MetricRegistry.collectMetrics(MetricRegistry.java:27) ~[?:?]
        at de.sldk.mc.MetricsController.lambda$handle$0(MetricsController.java:46) ~[?:?]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftFuture.run(CraftFuture.java:85) ~[spigot.jar:git-Paper-33d42c8e]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:423) ~[spigot.jar:git-Paper-33d42c8e]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:852) ~[spigot.jar:git-Paper-33d42c8e]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) ~[spigot.jar:git-Paper-33d42c8e]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:786) ~[spigot.jar:git-Paper-33d42c8e]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:678) ~[spigot.jar:git-Paper-33d42c8e]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]

Along with this, the entities section of the dashboard is showing "No data".

https://i.imgur.com/g0RZ778.png

Everything else seems to be working fine though. I am using v2.1.0 of the Prometheus Exporter MC plugin.

Any help would be appreciated.

Thanks

[Bug Report] Error while enabling

Hi,
after updating from 2.2.0 to 2.4.0 I got this StackTrace:

[16:06:27] [Server thread/INFO]: [PrometheusExporter] Reading player stats from folder  /home/mc/world/stats
[16:06:27] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 3a6f3db7-fddc-49bd-bea4-f725f30a3e1c.json
[16:06:27] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 61607f24-d95b-46f9-8f5a-0a9e207d15e5.json
[16:06:27] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 198f5e7c-3c1b-4def-8719-d4eb53ed3906.json
[16:06:27] [Server thread/INFO]: [PrometheusExporter] Found player stats file: a5195dc0-22cb-4a5b-a1b2-62d767c7700e.json
[16:06:27] [Server thread/ERROR]: Error occurred while enabling PrometheusExporter v2.4.0 (Is it up to date?)
com.jayway.jsonpath.PathNotFoundException: Missing property in path $['stats']
	at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:72) ~[?:?]
	at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79) ~[?:?]
	at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62) ~[?:?]
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:99) ~[?:?]
	at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:107) ~[?:?]
	at com.jayway.jsonpath.JsonPath.read(JsonPath.java:183) ~[?:?]
	at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:89) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.getPlayersStats(PlayerStatisticLoaderFromFile.java:98) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.lambda$readPlayerStatsFiles$4(PlayerStatisticLoaderFromFile.java:79) ~[?:?]
	at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
	at java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
	at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.readPlayerStatsFiles(PlayerStatisticLoaderFromFile.java:74) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.<init>(PlayerStatisticLoaderFromFile.java:43) ~[?:?]
	at de.sldk.mc.metrics.PlayerStatistics.<init>(PlayerStatistics.java:40) ~[?:?]
	at de.sldk.mc.config.MetricConfig.getMetric(MetricConfig.java:20) ~[?:?]
	at de.sldk.mc.config.PrometheusExporterConfig.lambda$enableConfiguredMetrics$1(PrometheusExporterConfig.java:62) ~[?:?]
	at java.util.Arrays$ArrayList.forEach(Arrays.java:4203) ~[?:?]
	at de.sldk.mc.config.PrometheusExporterConfig.enableConfiguredMetrics(PrometheusExporterConfig.java:61) ~[?:?]
	at de.sldk.mc.PrometheusExporter.onEnable(PrometheusExporter.java:18) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:643) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:304) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1118) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[patched_1.17.jar:git-Paper-"4e2f0be"]
	at java.lang.Thread.run(Thread.java:831) [?:?]
[16:06:27] [Server thread/INFO]: [PrometheusExporter] Disabling PrometheusExporter v2.4.0
[16:06:27] [Server thread/WARN]: [PrometheusExporter] Failed to stop metrics server gracefully: Cannot invoke "de.sldk.mc.MetricsServer.stop()" because "this.server" is null```

API

Hello, sladkoff.

Please, Can you give me the APIs you use in Decompile.

PS: Sorry for the spelling I'm french ;)

Thank you good day.

[Feature Request] Forge / Sponge support

I would like to have this plugin as a server side mod for forge server owners or just forge core server, or as a sponge plugin because sponge exists :)

Describe alternatives you've considered
I think there is no alternatives i think, i've done very little reserch so i don't realy know if anything exists

Trying to get maximal player count

Hello, I would like to add a panel for the maximal online player count. I tried max(mc_players_total{state="online"}) but it's not working; it's displaying players :(

How can I do this?

Building

How do I build this? keep getting this error on mvn clean install:

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------< de.sldk.mc:minecraft-prometheus-exporter >--------------
[INFO] Building minecraft-prometheus-exporter 1.3.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ minecraft-prometheus-exporter ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ minecraft-prometheus-exporter ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ minecraft-prometheus-exporter ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /home/graham/Downloads/minecraft-prometheus-exporter/target/classes
[INFO] Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/graham/Downloads/minecraft-prometheus-exporter/src/main/java/de/sldk/mc/MetricsController.java:[129,35] incompatible types: invalid method reference
    method intValue in class java.lang.Integer cannot be applied to given types
      required: no arguments
      found: java.lang.Object
      reason: actual and formal argument lists differ in length
[ERROR] /home/graham/Downloads/minecraft-prometheus-exporter/src/main/java/de/sldk/mc/MetricsController.java:[134,35] incompatible types: invalid method reference
    method intValue in class java.lang.Integer cannot be applied to given types
      required: no arguments
      found: java.lang.Object
      reason: actual and formal argument lists differ in length
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.471 s
[INFO] Finished at: 2019-08-16T07:45:12+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project minecraft-prometheus-exporter: Compilation failure: Compilation failure: 
[ERROR] /home/graham/Downloads/minecraft-prometheus-exporter/src/main/java/de/sldk/mc/MetricsController.java:[129,35] incompatible types: invalid method reference
[ERROR]     method intValue in class java.lang.Integer cannot be applied to given types
[ERROR]       required: no arguments
[ERROR]       found: java.lang.Object
[ERROR]       reason: actual and formal argument lists differ in length
[ERROR] /home/graham/Downloads/minecraft-prometheus-exporter/src/main/java/de/sldk/mc/MetricsController.java:[134,35] incompatible types: invalid method reference
[ERROR]     method intValue in class java.lang.Integer cannot be applied to given types
[ERROR]       required: no arguments
[ERROR]       found: java.lang.Object
[ERROR]       reason: actual and formal argument lists differ in length
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Tick times per entity

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Having the tick times for different entites would be nice. e.g villagers, hoppers, furnaces, zombies etc

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
I'll add a screenshot of what I mean when I can find it again

Raising ConcurrentModificationException

Seeing a few of these

infinity_1  | [09:51:48 WARN]: 2017-02-17 09:51:48.471:WARN:oejs.HttpChannel:qtp888103540-1642: /metrics
infinity_1  | java.util.ConcurrentModificationException
infinity_1  |   at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
infinity_1  |   at java.util.ArrayList$Itr.next(ArrayList.java:851)
infinity_1  |   at org.bukkit.craftbukkit.v1_11_R1.CraftWorld.getLivingEntities(CraftWorld.java:639)
infinity_1  |   at de.sldk.mc.MetricsController.handle(MetricsController.java:35)
infinity_1  |   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
infinity_1  |   at org.eclipse.jetty.server.Server.handle(Server.java:564)
infinity_1  |   at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:318)
infinity_1  |   at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
infinity_1  |   at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
infinity_1  |   at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:112)
infinity_1  |   at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
infinity_1  |   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
infinity_1  |   at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
infinity_1  |   at java.lang.Thread.run(Thread.java:745)

Only seen 1 of these so far

infinity_1  | [10:13:58 WARN]: 2017-02-17 10:13:58.474:WARN:oejs.HttpChannel:qtp888103540-5065: /metrics
infinity_1  | java.lang.NullPointerException
infinity_1  |   at it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap$MapIterator.nextEntry(Long2ObjectOpenHashMap.java:511)
infinity_1  |   at it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap$ValueIterator.next(Long2ObjectOpenHashMap.java:706)
infinity_1  |   at it.unimi.dsi.fastutil.objects.ObjectIterators.unwrap(ObjectIterators.java:228)
infinity_1  |   at it.unimi.dsi.fastutil.objects.ObjectIterators.unwrap(ObjectIterators.java:242)
infinity_1  |   at it.unimi.dsi.fastutil.objects.AbstractObjectCollection.toArray(AbstractObjectCollection.java:83)
infinity_1  |   at org.bukkit.craftbukkit.v1_11_R1.CraftWorld.getLoadedChunks(CraftWorld.java:143)
infinity_1  |   at de.sldk.mc.MetricsController.handle(MetricsController.java:32)
infinity_1  |   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
infinity_1  |   at org.eclipse.jetty.server.Server.handle(Server.java:564)
infinity_1  |   at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:318)
infinity_1  |   at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
infinity_1  |   at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
infinity_1  |   at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:112)
infinity_1  |   at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
infinity_1  |   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
infinity_1  |   at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
infinity_1  |   at java.lang.Thread.run(Thread.java:745)

Environment:
Using https://hub.docker.com/r/itzg/minecraft-server/

compose file

$ cat ~/config/servy/minecraft/docker-compose.yml
version: '3.0'

services:
  infinity:
    image: itzg/minecraft-server
    restart: always
    volumes:
      - /minecraft_infinity:/data
      - /storage/minecraft_infinity/plugins/dynmap:/data/plugins/dynmap
    ports:
      - 25565:25565
      - 80:8123
      - 9225:9225
    environment:
      - TYPE=SPIGOT
      - CONSOLE=false
      - EULA=TRUE
      - LEVEL_TYPE=LARGEBIOMES
      - PVP=TRUE
      - VIEW_DISTANCE=16
      - MAX_BUILD_HEIGHT=512
      - MAX_PLAYERS=100
      - OPS=zaquestion
      - DIFFICULTY=hard
      - JVM_OPTS=-Xmx8G -Xms1G

Things of note:
Server Type Spigot

[Bug Report] Exception fetching statistic KILL_ENTITY from player

Getting the following error on one of our servers. It's running Paper 1.17 Build 16

Error:

[23:58:56 WARN]: [PrometheusExporter] Exception fetching statistic KILL_ENTITY from player
java.lang.IllegalArgumentException: The supplied EntityType does not have a corresponding statistic
        at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at org.bukkit.craftbukkit.v1_17_R1.CraftStatistic.getStatistic(CraftStatistic.java:280) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer.getStatistic(CraftPlayer.java:1171) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromBukkit.getTypedStatistic(PlayerStatisticLoaderFromBukkit.java:82) ~[?:?]
        at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromBukkit.lambda$getPlayerStatistics$1(PlayerStatisticLoaderFromBukkit.java:52) ~[?:?]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:657) ~[?:?]
        at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromBukkit.lambda$getPlayerStatistics$2(PlayerStatisticLoaderFromBukkit.java:53) ~[?:?]
        at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
        at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromBukkit.getPlayerStatistics(PlayerStatisticLoaderFromBukkit.java:48) ~[?:?]
        at de.sldk.mc.metrics.PlayerStatistics.collectSuccessful(PlayerStatistics.java:59) ~[?:?]
        at de.sldk.mc.metrics.PlayerStatistics.collect(PlayerStatistics.java:48) ~[?:?]
        at de.sldk.mc.metrics.PlayerMetric.doCollect(PlayerMetric.java:21) ~[?:?]
        at de.sldk.mc.metrics.Metric.collect(Metric.java:34) ~[?:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at de.sldk.mc.MetricRegistry.collectMetrics(MetricRegistry.java:27) ~[?:?]
        at de.sldk.mc.MetricsController.lambda$handle$0(MetricsController.java:39) ~[?:?]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftFuture.run(CraftFuture.java:88) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1488) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:476) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1404) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1180) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[patched_1.17.jar:git-Paper-"24880b9"]
        at java.lang.Thread.run(Thread.java:831) [?:?]

[Bug Report] player_statistic not persisted over server restarts

I've noticed that after server restarts the player_statistic will no longer report anything. When a player logs on, only that player will be reported under player_statistic (even if that player then logs off).

This graph shows the total PLAY_ONE_MINUTE for all players. It decreases when the server restarts, and then increases vertically as a new player logs on to the restarted server.

image

It seems this is a limitation with Minecraft/bukkit. I wasn't able to dig into the code to investigate the root cause. Because Player is an interface, and I can't see what player.getStatistic(statistic) does.

Suggestion: PlayerStatistics saves a file with the most recent values. If player.getStatistic(statistic) returns null, then fetch the value from the file. This isn't a great idea...

[Bug Report] Throws exception if world doesn't have a stats directory

In case a world doesn't have stats saving on and / or simply no stats folder an exception is thrown.

The plugin continues to work, still it would be nicer to handle that case nicer.

I will submit a PR to return an empty hash map in case of no stats folder.

[21:18:25 INFO]: [PrometheusExporter] Enabling PrometheusExporter v2.4.0
[21:18:25 INFO]: [PrometheusExporter] Reading player stats from folder  /data/world/stats
[21:18:25 INFO]: [PrometheusExporter] Error - abandoning file reading
[21:18:25 WARN]: java.nio.file.NoSuchFileException: /data/world/stats
[21:18:25 WARN]: 	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
[21:18:25 WARN]: 	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[21:18:25 WARN]: 	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
[21:18:25 WARN]: 	at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
[21:18:25 WARN]: 	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
[21:18:25 WARN]: 	at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
[21:18:25 WARN]: 	at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
[21:18:25 WARN]: 	at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
[21:18:25 WARN]: 	at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
[21:18:25 WARN]: 	at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
[21:18:25 WARN]: 	at java.base/java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:71)
[21:18:25 WARN]: 	at java.base/java.nio.file.Files.walk(Files.java:3825)
[21:18:25 WARN]: 	at java.base/java.nio.file.Files.walk(Files.java:3879)
[21:18:25 WARN]: 	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.readPlayerStatsFiles(PlayerStatisticLoaderFromFile.java:69)
[21:18:25 WARN]: 	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.<init>(PlayerStatisticLoaderFromFile.java:43)
[21:18:25 WARN]: 	at de.sldk.mc.metrics.PlayerStatistics.<init>(PlayerStatistics.java:40)
[21:18:25 WARN]: 	at de.sldk.mc.config.MetricConfig.getMetric(MetricConfig.java:20)
[21:18:25 WARN]: 	at de.sldk.mc.config.PrometheusExporterConfig.lambda$enableConfiguredMetrics$1(PrometheusExporterConfig.java:62)
[21:18:25 WARN]: 	at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4390)
[21:18:25 WARN]: 	at de.sldk.mc.config.PrometheusExporterConfig.enableConfiguredMetrics(PrometheusExporterConfig.java:61)
[21:18:25 WARN]: 	at de.sldk.mc.PrometheusExporter.onEnable(PrometheusExporter.java:18)
[21:18:25 WARN]: 	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[21:18:25 WARN]: 	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380)
[21:18:25 WARN]: 	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483)
[21:18:25 WARN]: 	at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501)
[21:18:25 WARN]: 	at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415)
[21:18:25 WARN]: 	at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591)
[21:18:25 WARN]: 	at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281)
[21:18:25 WARN]: 	at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065)
[21:18:25 WARN]: 	at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289)
[21:18:25 WARN]: 	at java.base/java.lang.Thread.run(Thread.java:829)

[Question] HTTP Error Bad Gateway when adding to Grafana

I already have Grafana an Prometheus running monitoring the dedicated server itself, now I'm trying to add this exporter to monitor each minecraft server instance.
I've added the plugin to all servers and verified the port configuration on there along with restarting the servers.

I've configured the scrape config for Prometheus and it's like this:

global:
  scrape_interval:     15s
  evaluation_interval: 15s

rule_files:
  # - first.rules
  # - second.rules

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'node_exporter'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9100']
  - job_name: 'minecraft'
    static_configs:
      - targets: ['localhost:25578']

The servers are all hosted on the same machine as Prometheus and Grafana, I've tried opening the port outside through the firewall but it seems like grafana can't use the data source.

I've verified the plugin itself is working as I can access the data itself from http://46.4.72.117:25578/metrics

The servers are hosted on docker instances within the same dedicated box as grafana and prometheus.

TPS metric is inaccurate

I understand this plugin isn't officially supported on 1.8, but the metric always reads 20. It'd be nice if it worked on 1.8 too!

[Bug Report] Unknown panel type: gauge

Read before opening a bug report!

First, please ensure that you have done the following things on your own.

  • I have successfully configured Prometheus
  • I have successfully configured Grafana
  • I have added a valid scrape config for my Minecraft server in Prometheus
  • I know how to build Grafana dashboards and Prometheus queries

These steps are out of the scope of this issue tracker. If you have problems with any of these steps, please refer to the respective documentations:

image

Gauge module not working.

[Feature Request] finished prometheus.yml with minecraft job added

I can't seem to properly paste :

  • job_name: 'minecraft'
    static_configs:
    • targets: ['localhost:9225']
      labels:
      server_name: 'my-awesome-server'

into the config i keep getting indentation errors and :
line 14: field -targets not found in type config.plain\n line 15: field labels not found in type config.plain\n

Configuration help request

CentOS 7.3 latest
Spigot 1.11.2 latest
PrometheusExporter 1.1.0
Prometheus 1.6.1
Grafana 4.2.0

Everything is installed and running. Grafana dashboard widgets claim "Datasource named Prometheus was not found". Obviously, I have misconfigured the data stream, but I cannot see how. Any help deeply appreciated.

Grafana Datasource config:

Name: BlackDog
Type: Prometheus
Url: http://blackdog.straight8.com:9090
Access: direct
No auth

[Save & Test] returns Success. Datasource is working

Grafana Dashboards config:

Prometheus Stats revision 1 (Imported: 1)

PrometheusExporter/config.yml
port: 9090

Prometheus/prometheus.yml (business bits)

  - job_name: 'minecraft'
    static_configs:
      - targets: ['localhost:9090']

Grafana/grafana.ini: all default values

Worlds filter

Can the universe of worlds reported be filtered? Many of my worlds are uninteresting, in terms of entities and chunks loaded.

[Bug Report] Console is spammed with warning "The player has probably not been online since reboot."

Read before opening a bug report!

First, please ensure that you have done the following things on your own.

  • I have successfully configured Prometheus
  • I have successfully configured Grafana
  • I have added a valid scrape config for my Minecraft server in Prometheus
  • I know how to build Grafana dashboards and Prometheus queries

These steps are out of the scope of this issue tracker. If you have problems with any of these steps, please refer to the respective documentations:

I have weird behavior on the newest version.
It always spams the console with this warning:

[23:26:10 WARN]: [PrometheusExporter] Can not load player statistics for 'someuid1' from Bukkit API. The player has probably not been online since reboot.
[23:26:10 WARN]: [PrometheusExporter] Can not load player statistics for 'someuid2' from Bukkit API. The player has probably not been online since reboot.
[23:26:10 WARN]: [PrometheusExporter] Can not load player statistics for 'someuid3' from Bukkit API. The player has probably not been online since reboot.

Functionality is not impacted, but its pretty annoying to get 100+ lines per minute in the console.

[Question] Datapack?

I don’t know enough about the internals of plugins vs datapacks, but do you know if this would be possible on a vanilla server in datapack form?

Failed to read player statistic: Label cannot be null.

Hi,

I'm running PaperMC 1.14.1 (build #32), and I keep getting the above error. None of the individual statistics seem to be appearing in Prometheus, but I haven't been able to figure out why I'm getting the above error. I have individual player statistics enabled, and in the server logs the exporter confirms this by printing the warning to the console. Any ideas?

Screenshot 2019-05-20 at 20 52 32

On shutdown, I get a big error

[16:39:39 WARN]: [PrometheusExporter] Failed to read server statistic: null
[16:39:39 WARN]: java.lang.InterruptedException
[16:39:39 WARN]: at java.lang.Object.wait(Native Method)
[16:39:39 WARN]: at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftFuture.get(CraftFuture.java:50)
[16:39:39 WARN]: at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftFuture.get(CraftFuture.java:38)
[16:39:39 WARN]: at de.sldk.mc.MetricsController.handle(MetricsController.java:81)
[16:39:39 WARN]: at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
[16:39:39 WARN]: at org.eclipse.jetty.server.Server.handle(Server.java:564)
[16:39:39 WARN]: at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
[16:39:39 WARN]: at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
[16:39:39 WARN]: at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
[16:39:39 WARN]: at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
[16:39:39 WARN]: at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
[16:39:39 WARN]: at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:122)
[16:39:39 WARN]: at org.eclipse.jetty.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58)
[16:39:39 WARN]: at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201)
[16:39:39 WARN]: at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133)
[16:39:39 WARN]: at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
[16:39:39 WARN]: at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
[16:39:39 WARN]: at java.lang.Thread.run(Thread.java:748)

[Bug Report] com.jayway.jsonpath.PathNotFoundException: No results for path: $['stats']['minecraft:custom']

First, please ensure that you have done the following things on your own.

  • I have successfully configured Prometheus
  • I have successfully configured Grafana
  • I have added a valid scrape config for my Minecraft server in Prometheus
  • I know how to build Grafana dashboards and Prometheus queries

These steps are out of the scope of this issue tracker. If you have problems with any of these steps, please refer to the respective documentations:

Bug Report

[18:56:47] [Server thread/INFO]: [PrometheusExporter] Enabling PrometheusExporter v2.4.0
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Reading player stats from folder  /mnt/SSD1/MC/paperspigot1.16.5/world/stats
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 7f80c9ef-7968-336d-9498-f5c324f32abe.json
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 565457c4-0ddf-3829-9f79-80364f3cf10c.json
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 75740af5-4ac3-3329-a114-0f976993672e.json
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 9d6f121d-dac8-321c-b71d-8b1bf2abe325.json
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 3e5beb86-4984-3179-85bf-b05d9a52ec0d.json
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Found player stats file: 05f673da-66b5-37e3-b03b-09bbd9a7403e.json
[18:56:47] [Server thread/ERROR]: Error occurred while enabling PrometheusExporter v2.4.0 (Is it up to date?)
com.jayway.jsonpath.PathNotFoundException: No results for path: $['stats']['minecraft:custom']
	at com.jayway.jsonpath.internal.path.EvaluationContextImpl.getValue(EvaluationContextImpl.java:133) ~[?:?]
	at com.jayway.jsonpath.JsonPath.read(JsonPath.java:183) ~[?:?]
	at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:89) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.getPlayersStats(PlayerStatisticLoaderFromFile.java:98) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.lambda$readPlayerStatsFiles$4(PlayerStatisticLoaderFromFile.java:79) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile$$Lambda$4996/000000000000000000.apply(Unknown Source) ~[?:?]
	at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:178) ~[?:?]
	at java.util.stream.Collectors$$Lambda$205/000000000000000000.accept(Unknown Source) ~[?:?]
	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
	at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?]
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:497) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487) ~[?:?]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:239) ~[?:?]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.readPlayerStatsFiles(PlayerStatisticLoaderFromFile.java:74) ~[?:?]
	at de.sldk.mc.metrics.player.PlayerStatisticLoaderFromFile.<init>(PlayerStatisticLoaderFromFile.java:43) ~[?:?]
	at de.sldk.mc.metrics.PlayerStatistics.<init>(PlayerStatistics.java:40) ~[?:?]
	at de.sldk.mc.config.PrometheusExporterConfig$$Lambda$3482/000000000000000000.apply(Unknown Source) ~[?:?]
	at de.sldk.mc.config.MetricConfig.getMetric(MetricConfig.java:20) ~[?:?]
	at de.sldk.mc.config.PrometheusExporterConfig.lambda$enableConfiguredMetrics$1(PrometheusExporterConfig.java:62) ~[?:?]
	at de.sldk.mc.config.PrometheusExporterConfig$$Lambda$4935/000000000000000000.accept(Unknown Source) ~[?:?]
	at java.util.Arrays$ArrayList.forEach(Arrays.java:4421) ~[?:?]
	at de.sldk.mc.config.PrometheusExporterConfig.enableConfiguredMetrics(PrometheusExporterConfig.java:61) ~[?:?]
	at de.sldk.mc.PrometheusExporter.onEnable(PrometheusExporter.java:18) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-597]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-597]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-597]
	at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-597]
	at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-597]
	at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591) ~[patched_1.16.5.jar:git-Paper-597]
	at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.16.5.jar:git-Paper-597]
	at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-597]
	at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-597]
	at net.minecraft.server.v1_16_R3.MinecraftServer$$Lambda$3141/000000000000000000.run(Unknown Source) ~[?:?]
	at java.lang.Thread.run(Thread.java:836) [?:?]
[18:56:47] [Server thread/INFO]: [PrometheusExporter] Disabling PrometheusExporter v2.4.0
[18:56:47] [Server thread/WARN]: [PrometheusExporter] Failed to stop metrics server gracefully: null

[Feature Request] Have metric about count of each Entity

Hi,
Since the number of entities contribute at some extend to the load of the server it would be very nice to have data for all entities.

I imaging creating a new graph on dashboard besides the current "Entities" which has details about entity fluctuation over time.
I have a server where various entities are disabled or restriced (worldguard) .

Thanks,
/madi/

Using multiple instances of Prometheus Exporter on different Dashboards

Hi!

First of all, love the fact that this panel and this plugin exists because I love to view my Server Stats on a webpanel.

However, I would like to use Multiple MC servers to be displayed on their own Dashboard instead of combined in 1 Dashboard (if possible)
With using the Labels my prometheus.yml doesn't even save, just gives me errors that it can't load the config and with using 2 servers I get:

N/A for Players Online
N/A for JVM Memory
N/A for TPS

Any way to fix this?
Thanks in advance!

[Bug Report] Possible inaccuracy in 'tick_duration_*' metrics

Each of the four TickDurationCollector implementations gets a new reference to the Bukkit tick times reference. Each collector potentially works with a different array of tick times - this could lead to inaccuracies in the readings.

I don't know if this has an actual impact in the real world but in theory this is done incorrectly.

All four collectors should use the same tick times reference. The easiest way is to collect all four stats in one instance of TickDurationCollector. I think there are currently four sub-classes for this to allow for the separate configurations options: mc_tick_duration_*. It's probably ok to get rid of this and have only one setting mc_tick_durations for all four sub-stats.

jar file

Read before opening a question!

I cloned your repo and read your instructions for use. It starts with the jar file. However, after cloning the repo I cannot find a jar file anywhere. I am running minecraft in a k3 pod on a rpi 4b 8GB running a beta version of the 64 bit Pi OS. What could go wrong? Possibly I am trying to use this repo on an unsupported platform or in an unsupported manner? Thank you in advance for any attention.

First, please ensure that you have done the following things on your own.

  • I have successfully configured Prometheus
  • I have successfully configured Grafana
  • I have added a valid scrape config for my Minecraft server in Prometheus
  • I know how to build Grafana dashboards and Prometheus queries

These steps are out of the scope of this issue tracker. If you have questions about any of these steps, please refer to the respective documentations:

Bungee support would be epic!

I know this sort of falls under multiple server support (open ticket), but the ability to have it run in one location, with a per server plugin for individual server tps, memory, etc. Bungee would be more of a total player count across the network along with what server they;re on.

Thanks!

[Feature Request] Support of JVM metrics like micrometer

Is your feature request related to a problem? Please describe.
Although now it has a JVM of memeory usage, I'd like to inspect more details like the gc event, thread pool, class loader which could help to find out how to imporve the performance.

Describe the solution you'd like
Build in the micrometer lib and proxy its metrics result.

Describe alternatives you've considered
Might it not complex and you can do it without micrometer.

[Bug Report] My players online is weird

Read before opening a bug report!

First, please ensure that you have done the following things on your own.

  • [* ] I have successfully configured Prometheus
  • [* ] I have successfully configured Grafana
  • [* ] I have added a valid scrape config for my Minecraft server in Prometheus
  • [* ] I know how to build Grafana dashboards and Prometheus queries

These steps are out of the scope of this issue tracker. If you have problems with any of these steps, please refer to the respective documentations:

The nether is following the world even though theres sometimes 0 people in it

https://i.imgur.com/274KtWG.png

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.