Springinfo spring server status monitoring

Springinfo spring server status monitoring

Various things about Spring that do not fit in any of the other forums listed below, including forum rules.

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Springinfo spring server status monitoring

Post by Forboding Angel »

This is kinda unrelated to anything, but it should prove somewhat handy.

I've just added server status checking to springinfo so that when you go there, it will tell you if the master server and backup servers are up.

Nifty neato stuff.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Springinfo spring server status monitoring

Post by MidKnight »

yay! :-)
Caradhras
Posts: 381
Joined: 31 Jul 2006, 21:49

Re: Springinfo spring server status monitoring

Post by Caradhras »

nice
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Springinfo spring server status monitoring

Post by aegis »

what method do you use for checking if it's online?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Springinfo spring server status monitoring

Post by Forboding Angel »

Only checking port 8200

Here is the script if anyone else wants to use it. I didn't write it myself even thought I started to at first, but realized it was going to take a lot longer than just finding someone who had already done it.

Code: Select all

<div class="serverstatus"></div>
<?php
/////////////////////////////////////////////////////
// Server Monitor v1.0 - sebflipper Copyright 2004 //
//         http://www.sebflipper.com               //
//                                                 //
//      This is a simple script to monitor a       //
//      list of ports from a list of domains       //
                                                   //
//     Don't forget to download green.gif and      //
//        red.gif for the status icons             //
/////////////////////////////////////////////////////

// Config Area
// Enter a list of domain names you want to monitor
$domains = array("taspringmaster.clan-sy.com", "springbackup1.servegame.com", "springbackup2.servegame.org");
// Enter a list of ports you wish to monitor (80 = HTTP, 21 = FTP, 25 = SMTP, 3306 = MySQL)
$ports = array("8200");

// How often the page should refresh
$page_refresh = "3600"; // in seconds

?>
<?php
// PHP Script
// Turn off all error reporting
// Removes errors like fsockopen failed if the script couldn't connect to the port
error_reporting(0);

// Main moniting function
function server_monitor($domain,$port) {
    $fp = fsockopen ($domain, $port, $errno, $errstr, 10);
    if (!$fp) {
        return "<img src=images/red.gif alt='Status: Down, Domain: $domain, Port: $port'>\n";
    } else {
        return "<img src=images/green.gif alt='Status: Up, Domain: $domain, Port: $port'>\n";
    }
    fclose($fp);
}

// Foreach array
foreach ($domains as $domain_value) {
    echo "<div class='singleinfo'><center>&nbsp;<b>$domain_value: </b> ";
    foreach ($ports as $port_value) {
   }
    foreach ($ports as $port_value) {
        echo "&nbsp;&nbsp;". server_monitor($domain_value,$port_value) . "\n</center>";
   }
   echo "</div>";
}

?>
There is the script if anyone else would like to use it. It's pretty nifty.

Here are the icons:
Image
Image
Masure
Posts: 581
Joined: 30 Jan 2007, 15:23

Re: Springinfo spring server status monitoring

Post by Masure »

Good idea forb !

I'd suggest you to cache the monitoring result so each page rendered doesn't fsock lobby servers. What do you think about this ?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Springinfo spring server status monitoring

Post by Peet »

Yeah that's probably a good idea. Does dreamhost let you set up cronjobs for every 5-10 mins?
Masure
Posts: 581
Joined: 30 Jan 2007, 15:23

Re: Springinfo spring server status monitoring

Post by Masure »

No need to cron, a mysql table :

Code: Select all

PK serverurl varchar
checked_at timestamp
up boolean
server_monitor function tweaking to fsock only if the timestamp exceed x minutes otherwise you read the "up" value, and you're done.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Springinfo spring server status monitoring

Post by lurker »

Peet wrote:Yeah that's probably a good idea. Does dreamhost let you set up cronjobs for every 5-10 mins?
You forget that I run my lobby bot off of the dreamhost server?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Springinfo spring server status monitoring

Post by Forboding Angel »

Well basically this is how it works. WP caches the main page every 15 minutes. So every 15 minutes the servers get a ping, however, if 1 person hits the refresh button on their browser, WP re-Caches the page.

A lil confusing but that's kinda a halfway decent way of explaining it.

As far as linking it to a db... Why? Doesn't make any sense to me. WOuldn't it be better to have the actual servers track their uptime and whatnot?

Also keep in mind, I don't have access to the lobby servers, so everything I do has to be done via pings and things like that. I suppose I could set it up to track it, but I don't really feel like coding it :-/
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Springinfo spring server status monitoring

Post by MidKnight »

Masure wrote:Good idea forb !
Peet wrote:Yeah that's probably a good idea.
err, it kinda was my idea :-)

but ideas are cheap as dirt, implementation is what counts!

so...
Masure wrote:Nice work forb !
Peet wrote:Yeah that's good implementation.
fixed :wink:
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Springinfo spring server status monitoring

Post by Forboding Angel »

Masure wrote:Good idea forb !

I'd suggest you to cache the monitoring result so each page rendered doesn't fsock lobby servers. What do you think about this ?
It is cached, the cache updates every 15 minutes, and technically it only gets pinged once because of the way the caching works. Ping is only sent once every 15 minutes when the frontpage of the site is accessed.
aragon
Posts: 14
Joined: 20 Jan 2008, 13:44

Re: Springinfo spring server status monitoring

Post by aragon »

some uptime charts would be nice
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Springinfo spring server status monitoring

Post by Peet »

Someone (bibim?) has a huge stat system that has that already
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Springinfo spring server status monitoring

Post by Forboding Angel »

Oh thank god lol. I didn't want to have to be responsible for it hehe.

Do you happen to have a link peet? If so, I'll link to it from springinfo under the status thingy
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Springinfo spring server status monitoring

Post by Peet »

Hmm...after searching a bit it looks like he took it down (or at least the link to it). PM him I guess.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: Springinfo spring server status monitoring

Post by NOiZE »

perhaps it could show the number of players online/number of games being played. So ppl can see its an active community.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Springinfo spring server status monitoring

Post by AF »

lurker wrote:
Peet wrote:Yeah that's probably a good idea. Does dreamhost let you set up cronjobs for every 5-10 mins?
You forget that I run my lobby bot off of the dreamhost server?
How and what language?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Springinfo spring server status monitoring

Post by lurker »

Python. I just run it under screen; as long as you don't use a lot of ram or open up a socket for receiving you're fine. Actually, scratch that, I believe you can open a socket for receiving as long as nothing connects to it, but I'm not sure.
Post Reply

Return to “General Discussion”