All Projects → sladkoff → Minecraft Prometheus Exporter

sladkoff / Minecraft Prometheus Exporter

Licence: mit
A Bukkit plugin which exports minecraft server stats to Prometheus

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Minecraft Prometheus Exporter

Kafka exporter
Kafka exporter for Prometheus
Stars: ✭ 996 (+564%)
Mutual labels:  metrics, prometheus-exporter
Bull exporter
Prometheus exporter for Bull metrics
Stars: ✭ 149 (-0.67%)
Mutual labels:  metrics, prometheus-exporter
Promcord
📊 Analyze your entire discord guild in grafana using prometheus. Message, User, Game and Voice statistics...
Stars: ✭ 39 (-74%)
Mutual labels:  metrics, prometheus-exporter
Redis exporter
Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x, 4.x, 5.x and 6.x
Stars: ✭ 2,092 (+1294.67%)
Mutual labels:  metrics, prometheus-exporter
Bigbluebutton Exporter
Prometheus exporter for BigBlueButton
Stars: ✭ 117 (-22%)
Mutual labels:  metrics, prometheus-exporter
Iperf3 exporter
Simple server that probes iPerf3 endpoints and exports results via HTTP for Prometheus consumption
Stars: ✭ 30 (-80%)
Mutual labels:  metrics, prometheus-exporter
Citrix Adc Metrics Exporter
Export metrics from Citrix ADC (NetScaler) to Prometheus
Stars: ✭ 67 (-55.33%)
Mutual labels:  metrics, prometheus-exporter
Snmp exporter
SNMP Exporter for Prometheus
Stars: ✭ 705 (+370%)
Mutual labels:  metrics, prometheus-exporter
Memcached exporter
Exports metrics from memcached servers for consumption by Prometheus.
Stars: ✭ 109 (-27.33%)
Mutual labels:  metrics, prometheus-exporter
Tomcat exporter
A Prometheus exporter for Apache Tomcat
Stars: ✭ 99 (-34%)
Mutual labels:  metrics, prometheus-exporter
Unifiedmetrics
Fully-featured metrics collection agent for Minecraft servers. Supports Prometheus and InfluxDB. Dashboard included out-of-box.
Stars: ✭ 29 (-80.67%)
Mutual labels:  metrics, prometheus-exporter
Sidekiq Prometheus Exporter
All the basic metrics of Sidekiq with pluggable contribs prepared for Prometheus
Stars: ✭ 129 (-14%)
Mutual labels:  metrics, prometheus-exporter
Json Exporter
Prometheus exporter which fetches JSON from a URL and exports one of the values as gauge metrics
Stars: ✭ 26 (-82.67%)
Mutual labels:  metrics, prometheus-exporter
Ipsec exporter
Prometheus exporter for IPsec metrics.
Stars: ✭ 30 (-80%)
Mutual labels:  metrics, prometheus-exporter
Postgresql exporter
A Prometheus exporter for some postgresql metrics
Stars: ✭ 26 (-82.67%)
Mutual labels:  metrics, prometheus-exporter
Prom Confluence Exporter
Prometheus Exporter For Confluence
Stars: ✭ 62 (-58.67%)
Mutual labels:  metrics, prometheus-exporter
Haproxy exporter
Simple server that scrapes HAProxy stats and exports them via HTTP for Prometheus consumption
Stars: ✭ 465 (+210%)
Mutual labels:  metrics, prometheus-exporter
Statsd exporter
StatsD to Prometheus metrics exporter
Stars: ✭ 608 (+305.33%)
Mutual labels:  metrics, prometheus-exporter
Systemd exporter
Exporter for systemd unit metrics
Stars: ✭ 82 (-45.33%)
Mutual labels:  metrics, prometheus-exporter
Prometheus To Cloudwatch
Utility for scraping Prometheus metrics from a Prometheus client endpoint and publishing them to CloudWatch
Stars: ✭ 127 (-15.33%)
Mutual labels:  metrics, prometheus-exporter

Minecraft Prometheus Exporter

A Bukkit plugin which exports Minecraft server stats for Prometheus.

Quick Start

Drop 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:9225/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).

Plugin config

Here's a default config with annotations.

# 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: 9225
# 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
  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:9225']
      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:9225']
      labels:
        server_name: 'server1'
    - targets: ['localhost:9226']
      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

Available metrics

These are the stats that are currently exported by the plugin.

Label Description
mc_players_total Unique players on server (online + offline)
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_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 (experimental!)

⚠️ 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
mc_player_statistic Player statistics
mc_player_online Online state by player name

There's a sample dashboard available to get you started.

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 pseudo code 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;
  }

}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].