logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Basic webserver for alive check (Read 256 times)
x21-(DOG)-
Betatester
Offline


-(DOG)-

Posts: 21
Joined: Mar 30th, 2017
Gender: Male
Basic webserver for alive check
May 9th, 2017 at 3:11pm
Print Post  
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
  
Back to top
 
IP Logged
 
Gizzy
New Member
*
Offline


Oldunreal member

Posts: 46
Joined: Jul 10th, 2014
Re: Basic webserver for alive check
Reply #1 - May 9th, 2017 at 9:45pm
Print Post  
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
  
Back to top
 
IP Logged
 
x21-(DOG)-
Betatester
Offline


-(DOG)-

Posts: 21
Joined: Mar 30th, 2017
Gender: Male
Re: Basic webserver for alive check
Reply #2 - May 9th, 2017 at 11:44pm
Print Post  
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.
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7377
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Basic webserver for alive check
Reply #3 - May 10th, 2017 at 6:17am
Print Post  
guess it could work to use a masterserver entry as a health beacon
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
BobIsUnreal
God Member
*****
Offline


Guy who has too much time
invested to quit now

Posts: 721
Joined: Apr 12th, 2010
Gender: Male
Re: Basic webserver for alive check
Reply #4 - May 10th, 2017 at 6:28am
Print Post  
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.....
  

[REM_img]http://i.imgur.com/V3OSsDu.gif.disable[/img]http://i.imgur.com/JOu38Gs.gif
Back to top
IP Logged
 
x21-(DOG)-
Betatester
Offline


-(DOG)-

Posts: 21
Joined: Mar 30th, 2017
Gender: Male
Re: Basic webserver for alive check
Reply #5 - May 10th, 2017 at 6:26pm
Print Post  
@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.


Smirftsch wrote on May 10th, 2017 at 6:17am:
guess it could work to use a masterserver entry as a health beacon

Can this be implemented without using large amounts of memory?
  
Back to top
 
IP Logged
 
.:..:
Board Moderator
Developer Team
*****
Offline



Posts: 1403
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Basic webserver for alive check
Reply #6 - May 10th, 2017 at 6:42pm
Print Post  
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.
  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
ICQYIM  
IP Logged
 
x21-(DOG)-
Betatester
Offline


-(DOG)-

Posts: 21
Joined: Mar 30th, 2017
Gender: Male
Re: Basic webserver for alive check
Reply #7 - May 10th, 2017 at 7:59pm
Print Post  
Interestingly the output is not the same as the input I get back "\echo\0\queryid\49.1"
when i send "\echo\0\final\"
  
Back to top
 
IP Logged
 
x21-(DOG)-
Betatester
Offline


-(DOG)-

Posts: 21
Joined: Mar 30th, 2017
Gender: Male
Re: Basic webserver for alive check
Reply #8 - May 10th, 2017 at 9:19pm
Print Post  
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
)
 

  
Back to top
 
IP Logged
 
BobIsUnreal
God Member
*****
Offline


Guy who has too much time
invested to quit now

Posts: 721
Joined: Apr 12th, 2010
Gender: Male
Re: Basic webserver for alive check
Reply #9 - May 23rd, 2017 at 2:38am
Print Post  
Here is a simple implementation of the upd/python idea  curiously of Casey.

Ini file:
Serveractors=watchdog.watchdog




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

Code (C++)
Select All
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.
} 




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. Cheesy
« Last Edit: May 23rd, 2017 at 5:02am by BobIsUnreal »  

[REM_img]http://i.imgur.com/V3OSsDu.gif.disable[/img]http://i.imgur.com/JOu38Gs.gif
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo