Skip to main content

A blackbox_exporter-like prober for Minecraft

Project description

BlackCraft Exporter

License Issues Docker

A blackbox_exporter-like prober for Minecraft

To run

BlackCraft Exporter requires no configuration file and can be started with no extra argument.

By default, it will listen on tcp 0.0.0.0:9165. Run with --help argument to see all available CLI arguments

with PyPI

[!IMPORTANT] BlackCraft Exporter is a standalone application and has strict version requirements for its dependent Python packages. It's highly suggested to install it with pipx, or install it in a dedicated venv environment

BlackCraft Exporter is available on PyPI: blackcraft_exporter

You can install it with pipx

pipx install blackcraft_exporter

Then you should be able to run it using the blackcraft_exporter command (make sure your pipx binary $PATH has been set correctly)

$ blackcraft_exporter --version
BlackCraft Exporter v0.1.4
$ blackcraft_exporter
41832 2025-03-16 09:10:18.367 - INFO:     Starting BlackCraft Exporter v0.1.4
41832 2025-03-16 09:10:18.367 - INFO:     Started server process [41832]
41832 2025-03-16 09:10:18.368 - INFO:     Waiting for application startup.
41832 2025-03-16 09:10:18.368 - INFO:     Application startup complete.
41832 2025-03-16 09:10:18.368 - INFO:     Uvicorn running on http://0.0.0.0:9165 (Press CTRL+C to quit)

with docker

BlackCraft Exporter is available on DockerHub: fallenbreath/blackcraft_exporter

docker run --rm -p 9165/tcp fallenbreath/blackcraft_exporter

manual installation

  1. Install poetry
  2. Get the repository, run poetry install inside
  3. Run python -m blackcraft_exporter

To use

Basic usage

Just like the blackbox exporter, you need to send an HTTP GET request to the /probe endpoint to get the metrics of the target Minecraft server

curl http://localhost:9165/probe?type=java&target=mc.example.com

Query parameters:

  • type: The type of the Minecraft server. Options: java, bedrock
  • target: The address to the Minecraft server
  • timeout: (optional) The maximum request timeout in seconds, including all steps inside probing. Default: 10
  • mimic: (optional, java only) Override the hostname and port in the handshake packet. By default, the target parameter will be used
  • proxy: (optional, java only) If provided, connect to the server using the given proxy address
    • Supported http, socks4, socks5 proxy. See the python-socks library for more information
    • The address syntax is something like http://127.0.0.1:1081 or socks5://user:password@127.0.0.1:1080
  • max_attempts: (optional) The maximum probe attempts, including retries. Note that each attempt has the timeout of timeout / max_attempts. Default: 1

Prometheus

Example config for Minecraft Java Edition:

scrape_configs:
  - job_name: blackcraft          # Can be any name you want
    metrics_path: /probe
    params:
      type: [ java ]                # Set type to java
    static_configs:
      - targets:
        - 192.168.1.1             # IP only
        - 192.168.1.1:25566       # IP with port
        - mc.example.com          # Hostname only. SRV is supported
        - mc.example.com:25566    # Hostname with port
    relabel_configs:
      - source_labels: [ __address__ ]
        target_label: __param_target
      - target_label: __address__
        replacement: localhost:9165  # Your BlackCraft Exporter's hostname:port

Example config with more flexible control on the targets

scrape_configs:
  - job_name: blackcraft          # Can be any name you want
    metrics_path: /probe
    static_configs:
      - targets:
        - labels: 
            instance: 'My Java Server'  # Its disabled name in grafana
            type: 'java'
          targets: [ 'mc.example.com' ]
        - labels: 
            instance: 'My Bedrock Server'
            type: 'bedrock'
          targets: [ 'bedrock.example.com:25566' ]
    relabel_configs:
      - source_labels: [ type ]  # maps the "type" label into the query parameter
        target_label: __param_type
      - source_labels: [ __address__ ]
        target_label: __param_target
      - target_label: __address__
        replacement: localhost:9165  # Your BlackCraft Exporter's hostname:port

Grafana

Example dashboard for BlackCraft Exporter: https://grafana.com/grafana/dashboards/22915

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blackcraft_exporter-0.1.4.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blackcraft_exporter-0.1.4-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file blackcraft_exporter-0.1.4.tar.gz.

File metadata

  • Download URL: blackcraft_exporter-0.1.4.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for blackcraft_exporter-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e3bad0b28b00b89779cf84ed3d5ef0ec5b4b1ef97ddd07bac3f5eb86555bab7d
MD5 cf54b92c1550473740b2359436bb2a5a
BLAKE2b-256 a2c4050af7ac323d17264b7216f054263551262b04251c69726e09dd8e796ca3

See more details on using hashes here.

File details

Details for the file blackcraft_exporter-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: blackcraft_exporter-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for blackcraft_exporter-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6dec7088a7083b72a623765dc0deae6712a6f0542a3702bca3dbfa8f856862e6
MD5 5d2f075a0d39ed5ab8738842f14f2a92
BLAKE2b-256 0b5ace2c12dada03e4810fb1d36637085151034cee799deb65ee04401b4a0101

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page