Server Tools

eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
<div class="IPBDescription">How full is our server?</div> DMS has been putting in far too much time trying to figure out how to get from our log files a nice graph showing us how full the server was over a period of time. Now he's managed using Public_slots_free but that doesnt account for reserved slots, and using "entered" or "connected" and "disconnected" to parse the logs doesn't work well as it seems some conected and disconnected are logged twice!

Has anyone got such a tool already or must he continue this painful exercise.

If your wondering why you want to know it's because warservers have given us such a fabulous server we have cpu and bandwidth to spare. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->

Comments

  • SuperflySuperfly Join Date: 2002-11-01 Member: 3485Members, Constellation
    I am not aware of any such tool. However, you could create a tool that does a status or users console command every 30-60 seconds or so. That data would be accurate. I might be able to whip somthing up if you want me to give it a shot. But it would require PHP, a linux box and the ability to be able to schedule a CRON task.

    Let me know,
    Superfly
  • Pebbles-TPFPebbles-TPF Join Date: 2002-11-11 Member: 8237Members, Constellation
    what type of graph are you looking for?

    the stats program that I am developing has a minor thing link that, but it only works over hours at the moment. I can modify it to do days as well, but that would take me a couple of days.

    <i>Pebbs</i>
  • eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
    edited July 2003
    Superfly - Shame it would have to by Linux, our servers WinXP <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html/emoticons/sad.gif' border='0' style='vertical-align:middle' alt='sad.gif'><!--endemo--> although is there any reason your idea couldn't be adapted to run under windows? Perl, php, apache are all available for windows too and I can use windows task scheduler instead of CRON.

    Pebbles - I am very interested in Pebstats, but there seem to be no demo's available?

    /edit/ I think I've just seen one - it show connections but I want to see total active players instead.

    /edit/ also I have a linux box I use for my web server at the moment - so I guess we could use that.
  • SuperflySuperfly Join Date: 2002-11-01 Member: 3485Members, Constellation
    edited July 2003
    When I get home tonight I will see what I can do. You could use task scheduler and do what I was thinking. Only problem is that Windows Task Scheduler sucks and therefore is not very reliable. But I have a few PHP scripts that check server status I will see if they can be easily adaptable. Also, I will (if it works) log results to a MySQL database. If that is not convenient than I could log it to a flat text file.

    I will let you know how I progress,
    Superfly

    Edit:

    I just saw the rest of your post, if you have and would like to use your Linux webserver let me know. If you want it all conatined on the WinXP computer than that "should" work as well.
  • eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
    Mysql would be great, ideally I'd prefer it all on the 1 server (the windoze one) as the linux on is one is a bit weak and really needs re-installing after all the 'playing' I've done. If task scheduler proves to be really bad I can set something else up.

    Thank you very much for offering to look at this for me.
  • CheesyPetezaCheesyPeteza Join Date: 2002-11-24 Member: 9784Members, NS1 Playtester, Constellation
    I've got a linux script that checks to see if the server has players before running the stats. I've been working on making it record player numbers, map and cpu usage so I can plot some graphs. I can let you have a copy of it when I'm finished if you can find a linux box to run it on.

    Psychostats does a very simple graph of player connection attempts if that would suffice.
  • CrashCrash Join Date: 2002-11-01 Member: 3395Members, Constellation
    If you have AMX mod on your server, and wish to use the connection/disconnection logging system, I can make a script in about a minute that will simply spit out a log message everytime someone connects or disconnects.

    AMX doesn't double log, so it would work correctly.
  • cracker_jackmaccracker_jackmac Join Date: 2002-11-04 Member: 6891Members, Constellation, Reinforced - Shadow
    check out qstat, i think it will server your purpse
  • CheesyPetezaCheesyPeteza Join Date: 2002-11-24 Member: 9784Members, NS1 Playtester, Constellation
    Yeah I'm using qstat.
  • SuperflySuperfly Join Date: 2002-11-01 Member: 3485Members, Constellation
    Give this a try. I have not written a page to pull the data out yet but the following files allow you to schedule a task Via Windows XP Task scheduler that checks the amount of players on your server, it then logs the Number of players and the current Date and Time to a MySql database of your choice. I have included a .vbs script that allows the task to run invisible.

    You will need to modify two files.

    GetStat.vbs <-- Chang the path to your php.exe file as well as the path to the stats.php file(wherever you will run it from).

    settings.php <-- This should be obvious this file includes your MySql connection info as well as the name of the database and table you want to use.

    The stats.php script takes the following command line commands.

    flush <-- this will empty your table in the database.
    createdb <-- if you do not have a database yet this will create a database and table from the information you specified in the settings.php file.

    The proper syntax for running the php script with options is as follows:

    C:\php\php.exe -q c:\Stats\Stats.php createdb <-- this will create your database.
    C:\php\php.exe -q c:\Stats\Stats.php flush <-- this will flush the table data.
    C:\php\php.exe -q c:\Stats\Stats.php <-- this will log one entry into your database.

    This was created with PHP 4.3.1.

    When you schedule this in Windows you will need to choose to run it every day and then check the advanced options to repeat it every x number of minutes. It will probably take two tasks to run 12 hours at a time for this to work 24 hours.


    Note: Make sure that the database user that you specify has full (root) access to your MySql server.
  • CheesyPetezaCheesyPeteza Join Date: 2002-11-24 Member: 9784Members, NS1 Playtester, Constellation
    I found a tool called GameTrakker that does these things and more. I'm installing it now.

    <a href='http://games.gci.net/staticpages/index.php?page=20021024113239361' target='_blank'>GameTrakker</a>
  • dmsdms Join Date: 2003-03-23 Member: 14816Members
    hehe

    yeah i was bored and wanted something interesting todo, and i'd just gotten round to the idea of using qstat & wanted to figure out how to get it to timestamp its entries, but hell i see there are plenty of people who can do it already here ;-)

    I was a bit annoyed with the server logs, people connect (or "enter the game") without ever disconnecting so i was getting more players on the server than possible ;-)

    It'll be interesting to see server usage though.

    I thought of calculating a weighted average per hour of game time, so instead of a histogram with 2million points you have one point per hour, which is calculated on the (time*noplayers) / total time i.e. if 12 players for 30 mins and 0 players for 30 mins you get (12*30+0*30)/60 = 6.
  • eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
    Thanks SuperFly - I am having a bit of trouble with PHP on the server so installing it wasn't as quick as I wanted. If I want to run this from my linux server that's already running all the nessessary software do I just run<b> php -q stat.php </b>?
  • SuperflySuperfly Join Date: 2002-11-01 Member: 3485Members, Constellation
    yes the same commands should work in linux.
  • criticaIcriticaI Join Date: 2003-04-07 Member: 15269Banned, Constellation
    This is my server. PsychoStats really are awesome.

    <a href='http://www.nonoobs.com/stats/srvstats.html' target='_blank'>http://www.nonoobs.com/stats/srvstats.html</a>
  • biomassbiomass Join Date: 2003-03-15 Member: 14535Members, Constellation
    edited July 2003
    For platforms where rrdtool is available (no binaries for NT but according to the HP it does compile on NT =)) you could have something like this

    <a href='http://bs-linux.com/hlds_stats/' target='_blank'>http://bs-linux.com/hlds_stats/</a>

    with the help of this

    <a href='http://spokaneteamfortress.com/phlgui/hlds_stats.tar.gz' target='_blank'>http://spokaneteamfortress.com/phlgui/hlds...ds_stats.tar.gz</a>

    which is part of a greater package availble here (haven't tested this at all).

    <a href='http://spokaneteamfortress.com/phlgui/' target='_blank'>http://spokaneteamfortress.com/phlgui/</a>


    Gametrakker uses a similar technique and the predecessor software to rrdtool (mrtg) to produce the data graphs.
  • eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
    <!--QuoteBegin--eaglec+Jul 27 2003, 03:57 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (eaglec @ Jul 27 2003, 03:57 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Thanks SuperFly - I am having a bit of trouble with PHP on the server ... <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    Thanks the script works fine and is merrily taking player counts for us. I just need to sort out some sort of report now. Shouldn't be too much of a problem.

    I notice your script has none of those cumbersome comments <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo--> I dont suppose they're available... I kind of follow it and I think this is the bit that grabs the player number from the server
    fwrite($fp,"????players\x00");

    am I on the right lines ?
  • SuperflySuperfly Join Date: 2002-11-01 Member: 3485Members, Constellation
    Yeah, let me run through the script and I will comment it for you. The code you see there I took from another script that I found a while back. It has the ability to be a complete real-time server info script. So I’ve simply striped out the parts that are not needed.
  • SuperflySuperfly Join Date: 2002-11-01 Member: 3485Members, Constellation
    Here is the updated script with comments. Also see the following website I have learned most of what I know about querying a half-life server from this site and the examples he has released. <a href='http://dev.kquery.com/index.php?article=4' target='_blank'>http://dev.kquery.com/index.php?article=4</a> (also note that all this information is available in the Half-Life SDK) Kris form kquery has put allot of effort into making this information understandable to new coders. So it would be improper if I did not give him the credit he deserves.
  • farcryfarcry Join Date: 2003-06-22 Member: 17614Members
    i use perl + qstat + rrdtool to do my graphs... its not very hard.

    you get results like <a href='http://www.planetkaos.net/servers.php' target='_blank'>http://www.planetkaos.net/servers.php</a> (for sof2.. not hl)

    i could give you the script if you wants..
  • eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
    Thanks for the comments - that helps loads
    I like those graphs farcry - I wont say no to borowing your scripts if you don't mind!
  • dmsdms Join Date: 2003-03-23 Member: 14816Members
    edited August 2003
    forgot about this post ;-)

    <a href='http://ns1.muppetking.com/graphtest/' target='_blank'>http://ns1.muppetking.com/graphtest/</a>

    now the links not meant to be public do i'll pull it in a few hours, but i thought anyone readint the thread my be interested.

    we've used the software that some friendly chap offered eaglec and i've used a graphing package ontop of it to get something i'm very happy with indeed.

    its been very instructing to "learn" mysql, php & graphing software to extent to pull this off!

    //did i forget to say i'm **** after a buisness lunch, sorry for spelling - oh come on being drunk (word starting with p) isnt offensive surely!!!!
Sign In or Register to comment.