Web Hosting Talk







View Full Version : server status...


Steven.C
12-30-2002, 04:37 PM
I want to make a server status page, which will display Uptime/Users/Load the status of http, ssh, telnet, ftp, smtp, pop3, mysql. How could I do this?

I want something like phpmanager uses...

Thanks in advance for your help...:D

Vex
12-30-2002, 04:45 PM
Do you not want to use a premade script?

Steven.C
12-30-2002, 04:47 PM
I have no problem using a premade script if you know of any good ones...

James[UH]
12-30-2002, 04:49 PM
Check out me status page: http://status.uh-shells.co.uk

Code for uptime:


<?php echo exec("uptime");
echo("<br>");
$muh = exec("ps aux | grep -c muh");
$eggdrop = exec("ps aux | grep -c eggdrop");

echo(" There are $muh muh's running and $eggdrop eggdrops's running");

?>


Shows the uptime, also how many muh (bouncers), and eggdrops are running.

Now for the apache, ftp etc status:


<?php
$goat = "193.201.70.2";

function display_status($service, $status)
{
if ($status==1)
{
$message = "<font color=\"green\"><b>UP</b></font>";
}
else
{
$message = "<font color=\"red\"><b>DOWN</b></font>";
}

printf("<font face=\"Verdana\" size=\"2\ color=\"black\"><center>");
printf("$service is $message<br />");
}

// Apache (80)
$server = fsockopen ($goat, 80);
if (!$server) { display_status("Apache (80)", 0); }
else { display_status("Apache (80)", 1); fclose ($server); }

// MySQL
$server = fsockopen ($goat, 3306);
if (!$server) { display_status("MySQL", 0); }
else { display_status("MySQL", 1); fclose ($server); }

// POP3
$server = fsockopen ($goat, 110);
if (!$server) { display_status("POP3", 0); }
else { display_status("POP3", 1); fclose ($server); }

//SMTP
$server = fsockopen ($goat, 25);
if (!$server) { display_status("SMTP", 0); }
else { display_status("SMTP", 1); fclose ($server); }

// FTP
$server = fsockopen ($goat, 21);
if (!$server) { display_status("FTP", 0); }
else { display_status("FTP", 1); fclose ($server); }

// SSH
$server = fsockopen ($goat, 22);
if (!$server) { display_status("SSH", 0); }
else { display_status("SSH", 1); fclose ($server); }

?>


All this does is checks the port. Doesnt check for the actual process. So it may not be the best way of checking it.

Vex
12-30-2002, 04:49 PM
http://www.clook.net/freescripts/

jaming
12-30-2002, 05:55 PM
If you are using PHP, a good system status script can be found here: http://sourceforge.net/projects/phpsysinfo

hope that helps...

-JG

Steven.C
12-30-2002, 06:02 PM
Originally posted by Vex
http://www.clook.net/freescripts/

They have a really nice script, exactly what I was looking for. Thanks for your help, and thx clook.net for making such a wonderful script.

DomiNET.net
12-30-2002, 06:07 PM
http://nagios.org/

vipe
12-30-2002, 06:34 PM
Originally posted by LiNuX


They have a really nice script, exactly what I was looking for. Thanks for your help, and thx clook.net for making such a wonderful script.

I agree! Jim (owner of clookHOST) is a regular here on WHT too: Jim_UK
Drop him a thank you PM. ;)

Steven.C
12-30-2002, 06:41 PM
Yes...I know Jim...

Thanks for your great work...:)

daveman
12-30-2002, 06:54 PM
Originally posted by DomiNET.net
http://nagios.org/
That looks awesome!

newlyons
12-30-2002, 07:55 PM
It is, we use it to monitor everything for services, ports, cpu, load, memory, disk usage and more, for over 200 machines - it's a fantastic piece of kit. Mind you, we've enhanced it a bit by making it use MySQL and written some custom checks.

Highly Recommended.

Servstra-Sales
12-30-2002, 08:25 PM
I agree. Very impressive. :agree:

rbuecker
12-30-2002, 08:32 PM
Originally posted by newlyons
It is, we use it to monitor everything for services, ports, cpu, load, memory, disk usage and more, for over 200 machines - it's a fantastic piece of kit. Mind you, we've enhanced it a bit by making it use MySQL and written some custom checks.

Highly Recommended.

Right on! :)

Jim_UK
12-30-2002, 11:24 PM
Originally posted by LiNuX
Yes...I know Jim...

Thanks for your great work...:)
Ah yes, I think I remember you ;) Glad you like the script :)