Fetches some basic informations from your Valheim server and sends (optionally) messages to Telegram if a player joins or leaves your server.
Used libraries:
- query server data: node-GameDig
- cronjobs: node-schedule
- webserver: express
- http client: axios
- env variable handling: dotenv-defaults
- prometheus metrics: prometheus-api-metrics
- prometheus client: prom-client
First, install Node.js locally. Then create an .env file to override values from .env.defaults.
npm install
node server.js
Now open http:https://localhost:13080/status in your browser.
First create a docker-compose.yml file based on the docker-compose.example.yml. Adjust the environment variables to your needs.
docker-compose up
Alternatively you can use docker run as well:
docker run -e VALHEIM_HOST='my.valheim.host' \
-e VALHEIM_PORT='2457' \
-e VALHEIM_QUERY_CRON='*/5 * * * *' \
-e TELEGRAM_CHAT_ID='*-123456789' \
-e TELEGRAM_BOT='bot123456789:nuG0iuy7ae9eVah5eef8tahXee6eij8nieD' \
-e TELEGRAM_ENABLED='false' \
-e METRICS_ENABLED='true' \
-p 13080:13080 \
aldjinn/valheim-server-status:latest
Now open http:https://localhost:13080/status in your browser again.
If you have configured the Telegram settings correctly, a similar message should be sent to your chat after the application has started. As well if someone joines or leaves the server.
Some metrics are available for scraping via http:https://localhost:13080/metrics if the application is started with METRICS_ENABLED='true'.
# HELP player_count number of players
# TYPE player_count gauge
player_count 1
# HELP server_info server info
# TYPE server_info gauge
server_info{version="0.146.11",name="TheBigBadWolf",map="TheBigBadWolf"} 1