Giter Site home page Giter Site logo

jonathanc8 / pterodactyl_exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from loens2/pterodactyl_exporter

0.0 0.0 0.0 46 KB

Python script that extracts metrics from the Pterodactyl API and provides a metrics endpoint for Prometheus

License: MIT License

Python 95.59% Dockerfile 4.41%

pterodactyl_exporter's Introduction

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)

Run as service

Installed as user "prometheus":

  • To install with pip:
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
api_key: APIKEY_APIKEYAPIKEYAPIKEY
https: true
ignore_ssl: false
server_list_type: owner
  • 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
  • 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 2022

pterodactyl_exporter's People

Contributors

loens2 avatar galexrt avatar jonathanc8 avatar grimsi avatar rnelord avatar

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.