Go Back   Web Server Hosting Forum by BODHost > Support > PHP Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 07-16-07, 23:22
BOD Member
 
Join Date: Jul 2007
Posts: 296
Default cPanel Status Script

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
Reply With Quote
  #2 (permalink)  
Old 07-17-07, 04:56
BOD Member
 
Join Date: May 2007
Posts: 81
Smile

Nice Posting Taslayer keep it up.
Reply With Quote
  #3 (permalink)  
Old 07-17-07, 05:00
sam sam is offline
BOD Member
 
Join Date: Jul 2007
Posts: 141
Send a message via Yahoo to sam
Default

Thanx for giving your precious time to post this.:D
Reply With Quote
  #4 (permalink)  
Old 07-17-07, 11:32
BodShane's Avatar
Chief Operating Officer
 
Join Date: Dec 2006
Posts: 1,087
Send a message via AIM to BodShane Send a message via MSN to BodShane
Default

Perhaps, the stats can be a bit specific with the one's that have been mentioned above.
__________________
Redundant Dedicated Server Hosting Solutions Only at BODHost
24x7 Toll-Free ph. : +1. 866-662-0909
Email : sales@bodhost.com | MSN : sales@bodhost.com
Reply With Quote
  #5 (permalink)  
Old 07-17-07, 18:24
BOD Member
 
Join Date: Jul 2007
Posts: 296
Default

explain yourself
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 23:56.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.