Springinfo spring server status monitoring
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Springinfo spring server status monitoring
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.
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.
Re: Springinfo spring server status monitoring
what method do you use for checking if it's online?
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Springinfo spring server status monitoring
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.
There is the script if anyone else would like to use it. It's pretty nifty.
Here are the icons:


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> <b>$domain_value: </b> ";
foreach ($ports as $port_value) {
}
foreach ($ports as $port_value) {
echo " ". server_monitor($domain_value,$port_value) . "\n</center>";
}
echo "</div>";
}
?>
Here are the icons:


Re: Springinfo spring server status monitoring
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 ?
I'd suggest you to cache the monitoring result so each page rendered doesn't fsock lobby servers. What do you think about this ?
Re: Springinfo spring server status monitoring
Yeah that's probably a good idea. Does dreamhost let you set up cronjobs for every 5-10 mins?
Re: Springinfo spring server status monitoring
No need to cron, a mysql table :
server_monitor function tweaking to fsock only if the timestamp exceed x minutes otherwise you read the "up" value, and you're done.
Code: Select all
PK serverurl varchar
checked_at timestamp
up boolean
Re: Springinfo spring server status monitoring
You forget that I run my lobby bot off of the dreamhost server?Peet wrote:Yeah that's probably a good idea. Does dreamhost let you set up cronjobs for every 5-10 mins?
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Springinfo spring server status monitoring
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 :-/
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 :-/
Re: Springinfo spring server status monitoring
Masure wrote:Good idea forb !
err, it kinda was my ideaPeet wrote:Yeah that's probably a good idea.

but ideas are cheap as dirt, implementation is what counts!
so...
Masure wrote:Nice work forb !
fixedPeet wrote:Yeah that's good implementation.

- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Springinfo spring server status monitoring
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.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 ?
Re: Springinfo spring server status monitoring
some uptime charts would be nice
Re: Springinfo spring server status monitoring
Someone (bibim?) has a huge stat system that has that already
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Springinfo spring server status monitoring
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
Do you happen to have a link peet? If so, I'll link to it from springinfo under the status thingy
Re: Springinfo spring server status monitoring
Hmm...after searching a bit it looks like he took it down (or at least the link to it). PM him I guess.
Re: Springinfo spring server status monitoring
perhaps it could show the number of players online/number of games being played. So ppl can see its an active community.
Re: Springinfo spring server status monitoring
How and what language?lurker wrote:You forget that I run my lobby bot off of the dreamhost server?Peet wrote:Yeah that's probably a good idea. Does dreamhost let you set up cronjobs for every 5-10 mins?
Re: Springinfo spring server status monitoring
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.