please sticky this it is really useful and took me a while to make (a whole day)
Code:
/*
* +------------------------------------------------------------------------------+
* CPANEL STATUS SCRIPT
* +------------------------------------------------------------------------------+
* Copyright Notice(s)
* +------------------------------------------------------------------------------+
* Disclaimer Notice(s)
* ex: This code is freely given to you and given "AS IS", SO if it damages
* your computer, formats your HDs, or burns your house I am not the one to
* blame.
* Moreover, don't forget to include my copyright notices and name.
* +------------------------------------------------------------------------------+
*
* +------------------------------------------------------------------------------+
*/
// Configure script
$timeout = 1;
// Set service checks
$port[1] = 80;
$service[1] = 'Apache';
$ip[1] = '';
$port[2] = 21;
$service[2] = 'FTP';
$ip[2] = '';
$port[3] = 3306;
$service[3] = 'MYSQL';
$ip[3] = '';
$port[4] = 25;
$service[4] = 'Email(POP3)';
$ip[4] = '';
$port[5] = 143;
$service[5] = 'Email(IMAP)';
$ip[5] = '';
$port[6] = 2095;
$service[6] = 'Webmail';
$ip[6] = '';
$port[7] = 2082;
$service[7] = 'Cpanel';
$ip[7] = '';
$port[8] = 80;
$service[8] = 'Internet Connection';
$ip[8] = 'google.com';
$port[9] = 2086;
$service[9] = 'WHM';
$ip[9] = '';
//
// NO NEED TO EDIT BEYOND HERE UNLESS YOU WISH TO CHANGE STYLE OF RESULTS
//
?>
Service Status
// Count arrays
$ports = count($port) + 1;
$count = 1;
while ($count < $ports)
{
if ($ip[$count] == '')
{
$ip[$count] = 'localhost';
}
$fp = @fsockopen($ip[$count], $port[$count], $errno, $errstr, $timeout);
if (!$fp)
{
echo "\n \n \n\n";
fclose($fp);
}
else
{
echo "\n \n \n\n";
fclose($fp);
}
$count++;
}
//
// SERVER INFORMATION
//
?>
{$service[$count]} Offline
{$service[$count]} Online
Server Information
// GET SERVER LOADS
$loadresult = @exec('uptime');
preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $loadresult, $avgs);
// GET SERVER UPTIME
$uptime = explode(' up ', $loadresult);
$uptime = explode(',', $uptime[1]);
$uptime = $uptime[0] . ', ' . $uptime[1];
echo "\n \n \n\n\n \n \n\n";
?>
Server Load Averages $avgs[1], $avgs[2], $avgs[3]
Server Uptime $uptime