Skip to content

Data sources

Pavel Erokhin edited this page Nov 9, 2026 · 6 revisions

The dashboard reads two data sources, each through a variable at the top:

Variable Data source What it feeds
Prometheus Prometheus scraping minecraft-exporter Every graph, stat, and bar chart
WorldAPI Infinity, pointed at WorldAPI The “Chat”, “Events”, and “Console warnings and errors” tables

Without the second one the dashboard still works: only those three tables stay empty. Every Infinity query only reads (GET), so a read-only token is all it needs.

Prometheus with minecraft-exporter

  1. Run minecraft-exporter next to Prometheus. Its wiki shows the Docker service and the scrape job.
  2. Add Prometheus as a data source in Grafana, if it isn't there yet.
  3. Pick it in the dashboard's “Prometheus” variable.

The exporter reads what WorldAPI shows to every visitor. Give it a WorldAPI token, and the rows marked “Needs a WorldAPI token with …” fill in too:

Permission Rows and panels it fills
system:read Host
server:read Lag sources, the plugin list
players:private Coordinates in “Online now”
chat:read Chat by player
logs:read The console panels

No panel needs players:moderate, which also bans and kicks: leave it out. The “What the token can read” table in the Exporter row shows which endpoints the token opens.

Infinity with WorldAPI

The three tables ask WorldAPI directly, from Grafana's server, so the token never reaches a browser.

  1. Install the Infinity plugin: grafana cli plugins install yesoreyeram-infinity-datasource, or GF_PLUGINS_PREINSTALL_SYNC=yesoreyeram-infinity-datasource in Docker. Restart Grafana.

  2. Make a read-only WorldAPI token. In WorldAPI's config.yml:

    auth:
      tokens:
        - name: monitoring
          token: "64 random hex characters, like the output of openssl rand -hex 32"
          scopes: [viewer, "logs:read", "system:read"]

    viewer holds events:read for the event table and chat:read for the chat. logs:read opens the console table. The exporter can use the same token. Restart the server, or run /worldapi reload.

  3. In Grafana, add an Infinity data source:

    • URL: your WorldAPI with /api/v1, like http://minecraft:8110/api/v1. The tables ask /events and /server/logs under it.
    • Authentication: “Bearer token”, with the token from step 2.
    • Allowed hosts: the same URL. Infinity sends a token only to the hosts listed here.
  4. Pick it in the dashboard's “WorldAPI” variable.

WorldAPI records chat only with events.chat: true in its config, so the chat table stays empty until you turn it on.

Provisioned data sources

The same two data sources as a file, provisioning/datasources/minecraft.yml:

apiVersion: 1

datasources:
  - name: Prometheus
    uid: prometheus
    type: prometheus
    access: proxy
    url: http://prometheus:9090
    isDefault: true
    jsonData:
      timeInterval: 15s

  - name: WorldAPI
    uid: worldapi
    type: yesoreyeram-infinity-datasource
    url: $WORLDAPI_URL
    jsonData:
      auth_method: bearerToken
      allowedHosts: [$WORLDAPI_URL]
    secureJsonData:
      bearerToken: $WORLDAPI_TOKEN

Grafana fills $WORLDAPI_URL and $WORLDAPI_TOKEN from its environment, so the token stays out of the file.

Next: Keeping it private

Clone this wiki locally