For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Basic webserver for alive check

Report bugs, read about fixes, new features and ask questions about the Unreal 227 patch here. Place comments and commit suggestions.
Post Reply
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Basic webserver for alive check

Post by x21 »

Hello,

I was wondering if there's any basic webserver mod to implement a check to see if a server is alive or has hung
User avatar
Gizzy
OldUnreal Member
Posts: 1468
Joined: Thu Jul 10, 2014 7:13 pm

Re: Basic webserver for alive check

Post by Gizzy »

skw (I believe) made a tool that kept a server running and would automatically reboot it if it crashed, not sure how extensively it logs crashes though

summoning bob who probably has it archived somewhere
Last edited by Gizzy on Tue May 09, 2017 9:45 pm, edited 1 time in total.
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

Currently a simple batch loop can restart the server if it crashes, but it won't help if the server hangs. I want a more robust solution to the problem. I suppose web admin could be abused to do the job... But that's a clumsy way of doing things.
Last edited by x21 on Wed May 10, 2017 12:06 am, edited 1 time in total.
User avatar
Smirftsch
Administrator
Posts: 8999
Joined: Wed Apr 29, 1998 10:00 pm
Location: NaPali
Contact:

Re: Basic webserver for alive check

Post by Smirftsch »

guess it could work to use a masterserver entry as a health beacon
Sometimes you have to lose a fight to win the war.
User avatar
BobIsUnreal
OldUnreal Member
Posts: 805
Joined: Mon Apr 12, 2010 12:34 am

Re: Basic webserver for alive check

Post by BobIsUnreal »

Gizzy , this is what you talked about.
http://www.bobisunreal.com/Random/Forum/guard.zip
its not to much more then a batch file with colors and timestamps in batch saving,
witch is unneccesary with 227's logtimestamp argument.

detecting the hang via the webserver is kinda a noval idea althought i am not it would work, but it might.
you will have a issue tho - mapswitches. the webserver isnt "always" running. it dosnt run intill the map starts. so while you map is switching , you can get a false detection of failure, map switch time increases with package load/unloads and # of players.

if it was me i would create somthing with udplink and a python script that checks the server every minute or somthing, but you would have the same issue. to avoid the mp switch issue you would have to create a timeout , check multiple cycles. fail more then once, or programaticly acknoledge the map switch , but then you could very well hang during switch anyway.....
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

@Bob
I understand what you mean by the server going down during a map switch, however this is usually quite short and could be handled by multiple checks rather than just a single check. This should allow it to detect a hang quite easily.

guess it could work to use a masterserver entry as a health beacon
Can this be implemented without using large amounts of memory?
Last edited by x21 on Wed May 10, 2017 6:33 pm, edited 1 time in total.
User avatar
.:..:
OldUnreal Member
Posts: 1635
Joined: Tue Aug 16, 2005 4:35 am

Re: Basic webserver for alive check

Post by .:..: »

Easiest solution would be to send a simple ping query to the server uplink (using udp connection).

Send line "\echo\0\final\", and server responds with same line.
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

Interestingly the output is not the same as the input I get back "\echo\0\queryid\49.1"
when i send "\echo\0\final\"
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

I suppose I could try a simple solution like this

Code: Select all

ECHO \echo\0\final\|NC -u -w 1 %SVRIP% %SVRPORT%|FIND "\echo\0\queryid\"> NUL & IF ERRORLEVEL 1 (
    GOTO BAD
) ELSE (
    GOTO GOOD
)
Last edited by x21 on Wed May 10, 2017 9:23 pm, edited 1 time in total.
User avatar
BobIsUnreal
OldUnreal Member
Posts: 805
Joined: Mon Apr 12, 2010 12:34 am

Re: Basic webserver for alive check

Post by BobIsUnreal »

Here is a simple implementation of the upd/python idea  curiously of Casey.

Ini file:
Serveractors=watchdog.watchdog




echo only udplink src.
---------------------------------------------------------------

[code]class watchdog extends udplink
        transient;

function PostBeginPlay()
{
        linkmode = MODE_TEXT;
        bindport(1888,false);
}

event ReceivedText( IpAddr Addr, string Text )
{
        SendText(Addr,Text); //Just echo it back.
}[/code]


Python script. Meant to work only on linux.

Code: Select all

#!/usr/bin/env python

import socket
import time
import psutil #sudo apt-get install python-psutil

PROCNAME = "UCCLinux.bin"
IP = "127.0.0.1"

PORT = 1888


sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.settimeout(30)
sock.bind((IP,PORT-1))

counter = 0

while True:
        sock.sendto(":|",(IP,PORT))
        try:
                data, addr = sock.recvfrom(1024)
                counter = 0
                time.sleep(1)
        except socket.timeout:
                counter = counter + 1
                print "Counter = " + str(counter)
                if counter >= 10:
                        print "Ok attempting to kill..."
                        for proc in psutil.process_iter():
                                if proc.name( == PROCNAME:
                                        print proc.name( + "getting killed!!!"
                                        proc.kill()
                        counter = 0
this will check every 30 seconds 10 times for a reply , after the last attempt with no response, it will kill the proccess.

time for me to maybe go shoehorn this into the chatlinkbot so it messages the teamspeak everytime the server hangs. :D
Last edited by BobIsUnreal on Tue May 23, 2017 5:02 am, edited 1 time in total.
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

This is great. I ended up using the server query and searching for a string in the reply. The Python solution should work well for Windows too with some modifications. This script plus NSSM would almost certainly keep a server running. :)
User avatar
medor
OldUnreal Member
Posts: 343
Joined: Sun May 17, 2009 7:19 am

Re: Basic webserver for alive check

Post by medor »

ServerWatch is just excellent ... it work with unreal and ut
http://unrealtournament.99.free.fr/utfi ... h3.5.8.rar

You can set sounds for server down
sounds joint players leave players
Set your @ for advertise server down
Use the web admin with it
UTfiles http://medor.no-ip.org/
Image
Image
Image
Image
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

ServerWatch is just excellent ... it work with unreal and ut
http://unrealtournament.99.free.fr/utfi ... h3.5.8.rar

You can set sounds for server down
sounds joint players leave players
Set your @ for advertise server down
Use the web admin with it
Does this query the server?

EDIT: I had a look at serverwatch and it apears to be useless for my purpose.
Last edited by x21 on Fri Jun 23, 2017 2:48 am, edited 1 time in total.
User avatar
medor
OldUnreal Member
Posts: 343
Joined: Sun May 17, 2009 7:19 am

Re: Basic webserver for alive check

Post by medor »

Yes it do that
May be you not set it right
for the port server if you ave 7777 You must put 7778

Image

Last edited by medor on Fri Jun 23, 2017 4:24 am, edited 1 time in total.
UTfiles http://medor.no-ip.org/
Image
Image
Image
Image
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

Yes it do that
May be you not set it right
for the port server if you ave 7777 You must put 7778
I was looking for a solution that automatically recovers from a hang. I ended up writing a script to manage this.

Code: Select all

================================================================
SERVER NOT RESPONDING TO QUERY at 16:42:55.06 - Tue 06/20/2017
RESTARTING SERVER 
----------------------------------------------------------------
SERVER RESTARTED AT 16:43:02.74 - Tue 06/20/2017 
================================================================
As you can see it detects a server hang based on failed queries and automatially restarts the server. This way I don't have to worry about the server as much. I know it's running  ;)
Last edited by x21 on Fri Jun 23, 2017 8:36 am, edited 1 time in total.
User avatar
medor
OldUnreal Member
Posts: 343
Joined: Sun May 17, 2009 7:19 am

Re: Basic webserver for alive check

Post by medor »

Oh ok

i ave some script here but not test http://medor.no-ip.org/index.php?dir=En ... r_scripts/
UTfiles http://medor.no-ip.org/
Image
Image
Image
Image
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »


Python script. Meant to work only on linux.

Code: Select all

#!/usr/bin/env python

import socket
import time
import psutil #sudo apt-get install python-psutil

PROCNAME = "UCCLinux.bin"
IP = "127.0.0.1"

PORT = 1888


sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.settimeout(30)
sock.bind((IP,PORT-1))

counter = 0

while True:
        sock.sendto(":|",(IP,PORT))
        try:
                data, addr = sock.recvfrom(1024)
                counter = 0
                time.sleep(1)
        except socket.timeout:
                counter = counter + 1
                print "Counter = " + str(counter)
                if counter >= 10:
                        print "Ok attempting to kill..."
                        for proc in psutil.process_iter():
                                if proc.name( == PROCNAME:
                                        print proc.name( + "getting killed!!!"
                                        proc.kill()
                        counter = 0
I was thinking of doing something like this using win32serviceutil in Windows and this tool called nssm that allows ucc to run as a windows service.

https://nssm.cc/

=================================================
Oh ok

i ave some script here but not test http://medor.no-ip.org/index.php?dir=En ... r_scripts/
These are all linux scripts except for the telnet server.
Last edited by x21 on Fri Jun 23, 2017 8:53 pm, edited 1 time in total.
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

[code]class watchdog extends udplink
        transient;

function PostBeginPlay()
{
        linkmode = MODE_TEXT;
        bindport(1888,false);
}

event ReceivedText( IpAddr Addr, string Text )
{
        SendText(Addr,Text); //Just echo it back.
}[/code]
Do you think this can be ran using TCPLink instead of UDPLink? If so this can be implemented quite easily with something like this https://www.microsoft.com/en-us/downloa ... x?id=17148
Last edited by x21 on Fri Oct 13, 2017 8:42 pm, edited 1 time in total.
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: Basic webserver for alive check

Post by []KAOS[]Casey »

Late, but there is no specific reason why it TCP link couldn't be used.
User avatar
x21
OldUnreal Member
Posts: 84
Joined: Thu Mar 30, 2017 3:13 pm

Re: Basic webserver for alive check

Post by x21 »

Is there a way to abuse the local servers server query?
Last edited by x21 on Thu Aug 20, 2020 4:05 am, edited 1 time in total.
Post Reply

Return to “Unreal 227”