Coder Social home page Coder Social logo

cs2_exporter's Introduction

CS2 Prometheus exporter

The goal of this project is to provide a simple way to get metrics from CS2 game servers and store them on Prometheus.

How to install

Method 1 : With docker

docker run -d -p <external port>:9591 --name cs2_exporter --restart=always ghcr.io/revij/cs2_exporter:latest

Method 2 : Download sources and run

You need to have NodeJS installed if you want to run the sources, NVM (Node Version Manager) is a simple tool to get it running : https://github.com/nvm-sh/nvm

  1. Download the repo (using git clone or direct zip download)
  2. Enter the cs2_exporter directory and run npm i, this will install all required dependencies
  3. Start the script with node : node index.js, you can create a service or run it in a screen to keep it active in background

By default, the exporter runs on port 9591, it's possible to customize this by setting the HTTP_PORT variable to the desired port.

Configure the game server

  1. Configure a rcon password password either via command line:
+rcon_password <password>

or under your server.cfg file:

rcon_password "<password>"
  1. Make sure that your server's firewall allows the exporter to connect to the game server's RCON port (TCP).

Configure Prometheus

Add the following configuration to Prometheus static configuration :

- job_name: 'cs2_exporter'
    static_configs:
      - targets: ["<ip>:<port>:<rconpassword>"]


    relabel_configs:
      - source_labels: [__address__]
        regex: "(.+):.+:.+"
        replacement: "$1"
        target_label: __param_ip
      - source_labels: [__address__]
        regex: ".+:(.+):.+"
        replacement: "$1"
        target_label: __param_port
      - source_labels: [__address__]
        regex: ".+:.+:(.+)"
        replacement: "$1"
        target_label: __param_password
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: <IP>:<port> # Real exporter's IP:Port

How to access

If you want to see what the exporter returns, you can access :

http://<ip>:9591/metrics?ip=<server ip>&port=<server port>&password=<rcon password>

Support

If you encounter any issue, feel free to open an issue on the github repository!

cs2_exporter's People

Contributors

unyxos avatar revij 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.