Valheim/udp service monitoring #524

Closed
opened 2026-02-28 01:49:29 -05:00 by deekerman · 13 comments
Owner

Originally created by @Setsua on GitHub (Nov 3, 2021).

I was looking for a way to monitor valheim with uptime kuma which is not (yet?) possible with Uptime Kuma.
But I found a workaround which could help a few people.

I've installed nginx on my valheim server.
I've added a cronjob which checks every minute if the process is running and post a 1 into a html file, if not echo a 0 into it.

* * * * * if [ $(pidof ./valheim_server.x86_64) ]; then echo 1 > /var/www/html/index.html; else echo 0 > /var/www/html/index.html;fi

Then I used the HTTP(s) Keyword request to look for a 1 at given address.

keyword

Note: If this "Issue" isnt valid just delete it.

#551
#9

Originally created by @Setsua on GitHub (Nov 3, 2021). I was looking for a way to monitor valheim with uptime kuma which is not (yet?) possible with Uptime Kuma. But I found a workaround which could help a few people. I've installed nginx on my valheim server. I've added a cronjob which checks every minute if the process is running and post a 1 into a html file, if not echo a 0 into it. `* * * * * if [ $(pidof ./valheim_server.x86_64) ]; then echo 1 > /var/www/html/index.html; else echo 0 > /var/www/html/index.html;fi` Then I used the HTTP(s) Keyword request to look for a 1 at given address. ![keyword](https://user-images.githubusercontent.com/37017004/140230910-ea3993c9-502b-4a64-afed-72fc4a5d9715.png) Note: If this "Issue" isnt valid just delete it. #551 #9
Author
Owner

@deefdragon commented on GitHub (Nov 3, 2021):

This would likely be better done with a push based monitor. No need to go through with installing nginx on the machine. Just send the response to kuma directly.

@deefdragon commented on GitHub (Nov 3, 2021): This would likely be better done with a [push based monitor](https://github.com/louislam/uptime-kuma/issues/744#issuecomment-947219792). No need to go through with installing nginx on the machine. Just send the response to kuma directly.
Author
Owner

@takaze212 commented on GitHub (Nov 4, 2021):

  1. Create script
    nano /opt/check_service.sh
#!/bin/bash

service=$1
url=$2

if [ -z "$url" ] || [ -z "$service"]
  then
    echo "argument missing"
    echo "usage check_service.sh [servicename] [push URL]"
    exit
fi

/bin/systemctl -q is-active "$service.service"
status=$?
if [ "$status" == 0 ]; then
    curl --silent --output /dev/null $url
fi
  1. make executable
    chmod +x /opt/check_service.sh

  2. create contab, run every minute
    crontab -e
    * * * * * /opt/check_service.sh [[YOUR_SERVICENAME_HERE]] [[YOUR_UPTiME_PUSH_URL_HERE]] > /dev/null

  3. enjoy :)

//edit: typos fixed

@takaze212 commented on GitHub (Nov 4, 2021): 1. Create script `nano /opt/check_service.sh` ``` #!/bin/bash service=$1 url=$2 if [ -z "$url" ] || [ -z "$service"] then echo "argument missing" echo "usage check_service.sh [servicename] [push URL]" exit fi /bin/systemctl -q is-active "$service.service" status=$? if [ "$status" == 0 ]; then curl --silent --output /dev/null $url fi ``` 2. make executable `chmod +x /opt/check_service.sh` 3. create contab, run every minute `crontab -e` `* * * * * /opt/check_service.sh [[YOUR_SERVICENAME_HERE]] [[YOUR_UPTiME_PUSH_URL_HERE]] > /dev/null` 4. enjoy :) //edit: typos fixed
Author
Owner

@Setsua commented on GitHub (Nov 6, 2021):

This would likely be better done with a push based monitor. No need to go through with installing nginx on the machine. Just send the response to kuma directly.

Thanks. Did not know of push api calls. Way better solution.

@Setsua commented on GitHub (Nov 6, 2021): > This would likely be better done with a [push based monitor](https://github.com/louislam/uptime-kuma/issues/744#issuecomment-947219792). No need to go through with installing nginx on the machine. Just send the response to kuma directly. Thanks. Did not know of push api calls. Way better solution.
Author
Owner

@rezzorix commented on GitHub (Nov 10, 2021):

Could be more reliable and easier to check your Valheim Server status using the steam api...

You get your api key here: https://steamcommunity.com/dev/apikey

This would be the link to a site that gives you all information available for your server in json format:
https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\your-server-ip:port&key=steamapikey

The "appid" above is already the Valheim app ID - you can of course get this info for other servers, too, just check on steam.

You can see an example of how it is implemented on a website here

@rezzorix commented on GitHub (Nov 10, 2021): Could be more reliable and easier to check your Valheim Server status using the steam api... You get your api key here: https://steamcommunity.com/dev/apikey This would be the link to a site that gives you all information available for your server in json format: `https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\your-server-ip:port&key=steamapikey` The "appid" above is already the Valheim app ID - you can of course get this info for other servers, too, just check on steam. You can see an example of how it is implemented on a website [here](https://goodclan.net/game-servers/valheim/)
Author
Owner

@louislam commented on GitHub (Nov 10, 2021):

Could be more reliable and easier to check your Valheim Server status using the steam api...

You get your api key here: https://steamcommunity.com/dev/apikey

This would be the link to a site that gives you all information available for your server in json format: https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\your-server-ip:port&key=steamapikey

The "appid" above is already the Valheim app ID - you can of course get this info for other servers, too, just check on steam.

You can see an example of how it is implemented on a website here

If it is using steam server, uptime kuma is already supported it.

@louislam commented on GitHub (Nov 10, 2021): > Could be more reliable and easier to check your Valheim Server status using the steam api... > > You get your api key here: https://steamcommunity.com/dev/apikey > > This would be the link to a site that gives you all information available for your server in json format: `https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\your-server-ip:port&key=steamapikey` > > The "appid" above is already the Valheim app ID - you can of course get this info for other servers, too, just check on steam. > > You can see an example of how it is implemented on a website [here](https://goodclan.net/game-servers/valheim/) If it is using steam server, uptime kuma is already supported it.
Author
Owner

@rezzorix commented on GitHub (Nov 11, 2021):

Yes, but in Uptime with Steam-Monitor you will only get the online status.

If you directly parse the json output of the API you get also things like "players online", "bots online", "server version", etc. etc. (depending on what the game provides)

@rezzorix commented on GitHub (Nov 11, 2021): Yes, but in Uptime with Steam-Monitor you will only get the online status. If you directly parse the json output of the API you get also things like "players online", "bots online", "server version", etc. etc. (depending on what the game provides)
Author
Owner

@aarste commented on GitHub (Dec 19, 2021):

What should be put into the hostname and port fields for Steam Game Server? I have an anonymously installed valheim server (via steamcmd) running public on a windows machine 192.168.1.11 with ports 2456-2458 exposed. Uptime Kuma also has my steam API in the settings but the check fails with the following attempts:

192.168.1.11
htpc.home
public static IP
port 2456

This address returns a {"response":{}}
https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr[public ip removed]:2456&key=[key removed]

@aarste commented on GitHub (Dec 19, 2021): What should be put into the hostname and port fields for Steam Game Server? I have an anonymously installed valheim server (via steamcmd) running public on a windows machine 192.168.1.11 with ports 2456-2458 exposed. Uptime Kuma also has my steam API in the settings but the check fails with the following attempts: 192.168.1.11 htpc.home public static IP port 2456 This address returns a {"response":{}} https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\[public ip removed]:2456&key=[key removed]
Author
Owner

@rezzorix commented on GitHub (Dec 20, 2021):

Is your server reachable from the outside on your public IP?
Did you configure correct port forwarding in your router?

@rezzorix commented on GitHub (Dec 20, 2021): Is your server reachable from the outside on your public IP? Did you configure correct port forwarding in your router?
Author
Owner

@rezzorix commented on GitHub (Dec 20, 2021):

Oh and just another note; if not explicitly set different, the query port for Valheim server should be 2457

@rezzorix commented on GitHub (Dec 20, 2021): Oh and just another note; if not explicitly set different, the query port for Valheim server should be 2457
Author
Owner

@aarste commented on GitHub (Dec 20, 2021):

Oh and just another note; if not explicitly set different, the query port for Valheim server should be 2457

That port number fixed it for me, steam web api shows my stats and uptime kuma is able to see it now, thank you!

@aarste commented on GitHub (Dec 20, 2021): > Oh and just another note; if not explicitly set different, the query port for Valheim server should be 2457 That port number fixed it for me, steam web api shows my stats and uptime kuma is able to see it now, thank you!
Author
Owner

@MWG-Logan commented on GitHub (Jun 10, 2022):

https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\your-server-ip:port&key=steamapikey

thank you massively for this- solid workaround to no gamedig in some situations

@MWG-Logan commented on GitHub (Jun 10, 2022): > https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\your-server-ip:port&key=steamapikey thank you massively for this- solid workaround to no gamedig in some situations
Author
Owner

@InsertDisc commented on GitHub (Oct 16, 2022):

What should be put into the hostname and port fields for Steam Game Server? I have an anonymously installed valheim server (via steamcmd) running public on a windows machine 192.168.1.11 with ports 2456-2458 exposed. Uptime Kuma also has my steam API in the settings but the check fails with the following attempts:

192.168.1.11 htpc.home public static IP port 2456

This address returns a {"response":{}} https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr[public ip removed]:2456&key=[key removed]

I've installed a Satisfactory Server exactly the same way 'anonymous with steamcmd' and am also getting a no response and have no idea what I'm doing wrong. Tried every port that I can think of that the server uses to no avail.

@InsertDisc commented on GitHub (Oct 16, 2022): > What should be put into the hostname and port fields for Steam Game Server? I have an anonymously installed valheim server (via steamcmd) running public on a windows machine 192.168.1.11 with ports 2456-2458 exposed. Uptime Kuma also has my steam API in the settings but the check fails with the following attempts: > > 192.168.1.11 htpc.home public static IP port 2456 > > This address returns a {"response":{}} [https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=\appid\892970\addr\[public](https://api.steampowered.com/IGameServersService/GetServerList/v1/?filter=%5Cappid%5C892970%5Caddr%5C%5Bpublic) ip removed]:2456&key=[key removed] I've installed a Satisfactory Server exactly the same way 'anonymous with steamcmd' and am also getting a no response and have no idea what I'm doing wrong. Tried every port that I can think of that the server uses to no avail.
Author
Owner

@CommanderStorm commented on GitHub (Dec 10, 2023):

Closing as valheim is supprorted via the gamedig monitor: https://github.com/gamedig/node-gamedig/blob/master/GAMES_LIST.md
No extra monitor nessesary
=> closing as resolved

@CommanderStorm commented on GitHub (Dec 10, 2023): Closing as valheim is supprorted via the `gamedig` monitor: https://github.com/gamedig/node-gamedig/blob/master/GAMES_LIST.md No extra monitor nessesary => closing as resolved
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/uptime-kuma#524
No description provided.