Skip to main content

Metrics exporter for Pterodactyl

Project description

Pterodactyl Exporter

Please use the Discussion for Support rather than the Issues.

A python script that exports performance metrics from Pterodactyl Panel 1.x via the Client API, converts the data to the correct format and provides a prometheus target.

This can be used for time series monitoring of Pterodactyl game servers and visualization with Grafana.

Feel free to try this script and submit an issue if needed.

How to install

What you need:

  • Linux server (should run on Windows as well, but is only tested in a linux environment)
  • Prometheus
  • Python (3.10)
  • Pterodactyl client API key
    • Service account with read only is recommended
    • You only need to set Backup->Read as permission for the account to the server you want to monitor.

Run as Pterodactyl Server

  • Download the Egg JSON from egg/egg-pterodactyl-exporter.json or the releases
  • Import the Egg into the Nest of your choice
  • Create the server from the egg and fill in the required config values
  • Run the server

Run as service

Installed as user "prometheus":

  • To install with pipx:
pipx install pterodactyl-exporter
  • To install with pip (not recommended, could break system dependencies):
pip install pterodactyl-exporter
  • Create directory pterodactyl_exporter.

  • Create the config file config.yml in that directory (set the values as needed, it's recommended to use https):

host: panel.example.com
host_port: # This is the port of the panel (optional)
port: 9531 #Standard port for the exporter
api_key: APIKEY_APIKEYAPIKEYAPIKEY
https: true
ignore_ssl: false
server_list_type: owner
query_interval: 10 # Interval in seconds between each query to the Pterodactyl panel (default: 10)
  • Create systemd service /etc/systemd/system/pterodactyl_exporter.service:
[Unit]
Description=Prometheus Server
After=network-online.target

[Service]
User=prometheus
Restart=on-failure
ExecStart=pterodactyl_exporter \
--config-file=/home/prometheus/pterodactyl_exporter/config.yml

[Install]
WantedBy=multi-user.target
  • Enable and start the service.

  • Add a job configuration:

- job_name: 'pterodactyl_exporter'
   static_configs:
     - targets: ['localhost:9531']
  • To get the Grafana dashboard, import id 16575. Alternatively download the JSON file from the releases.

To show and hide servers from being monitored, just remove the read permission of the service account on that Server

Run with Docker

  • Create a folder named pterodactyl_exporter

  • Download the config file from GitHub:

curl -fsSL -o config.yml https://raw.githubusercontent.com/LOENS2/pterodactyl_exporter/master/config.example.yml
  • Create a folder named docker

  • Download the docker-compose.yml into that folder:

curl -fsSL -o docker-compose.yml https://raw.githubusercontent.com/LOENS2/pterodactyl_exporter/master/docker/docker-compose.yml
  • Run the container:
docker-compose up -d

Run manually

Only meant for testing purposes, not recommended for production use!

  • Clone the project:
git clone https://github.com/LOENS2/pterodactyl_exporter.git
  • Change to the cloned directory
cd pterodactyl_exporter
  • Install dependencies:
python -m pip install -r requirements.txt
  • Run with python:
python -m pterodactyl_exporter.pterodactyl_exporter --config-file=config.example.yml

Troubleshooting

You can view the output with (Time is UTC):

sudo journalctl -u pterodacyl_exporter.service -b --since "2024-12-14 13:45:27"

Post any stacktraces as an Issue.

With special thanks to @grimsi for helping me with docker.

© LOENS2 2023

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

pterodactyl_exporter-1.0.6.post1.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

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

pterodactyl_exporter-1.0.6.post1-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file pterodactyl_exporter-1.0.6.post1.tar.gz.

File metadata

File hashes

Hashes for pterodactyl_exporter-1.0.6.post1.tar.gz
Algorithm Hash digest
SHA256 f479629210f84886e44c646cf4aef4180157cad32701184a00b1a89874157665
MD5 5ab932d105c1397ec714b2550eb02461
BLAKE2b-256 928c09ebce765b1cd378b3dccccde6b2036f074c766a3a569743a9a818c1c9ce

See more details on using hashes here.

File details

Details for the file pterodactyl_exporter-1.0.6.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for pterodactyl_exporter-1.0.6.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 bcebb590571095497602b40db389338a1f34546f55f7cf7c103926be2bfd5694
MD5 e87488d990e1a91e7045f9e31cbf36fe
BLAKE2b-256 a7b4abf1d12b02223238a5e89c4a8df780508b3ec74cbe286994929ccc3a2ec1

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