UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  eUKhost's Official Web Hosting Forum > Technical Support > VPS Hosting - Virtual Private Servers

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 24-11-2009, 02:27
Member
 
Join Date: Dec 2008
Posts: 33
Default server status outside of the whm

Hello,

Just wondering if its possible to have the server status statistics available to view outisde the whm of a VPS account?

Only reason I ask is it would be nice to view the server status on an html page so I could even keep an eye on CPU usage, memory etc via my phone.

Any advise would be greatly appreciated
Kind Regards
Sam
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 24-11-2009, 05:38
Rock's Avatar
Technical Support (eUKhost.com)
 
Join Date: Oct 2006
Location: localhost
Posts: 3,356
Send a message via MSN to Rock Send a message via Skype™ to Rock
Smile

Quote:
Originally Posted by sam_m08 View Post
Hello,

Just wondering if its possible to have the server status statistics available to view outisde the whm of a VPS account?

Only reason I ask is it would be nice to view the server status on an html page so I could even keep an eye on CPU usage, memory etc via my phone.

Any advise would be greatly appreciated
Kind Regards
Sam
Hi Sam,

You can use either of these scripts which can serve the purpose of server monitoring:

Memory monitor:
PHP Code:
<?php
    exec 
("cat /proc/meminfo"$details);
    
$mem1 $details[0]."<br />".$details[1]."<br />".$details[2]."<br />".$details[3];
    echo 
"Memory info: <br>$mem1<br />";
?>
Load monitor:
PHP Code:
<?php

define
("TEMP_PATH","/tmp/");

class 
CPULoad {
        function 
check_load() {
                
$fd fopen("/proc/stat","r");
                if (
$fd) {
                        
$statinfo explode("\n",fgets($fd1024));
                        
fclose($fd);
                        foreach(
$statinfo as $line) {
                                
$info explode(" ",$line);
                                if(
$info[0]=="cpu") {
                                        
array_shift($info);  // pop off "cpu"
                                        
if(!$info[0]) array_shift($info); // pop off blank space (if any)
                                        
$this->user $info[0];
                                        
$this->nice $info[1];
                                        
$this->system $info[2];
                                        
$this->idle $info[3];
//                                      $this->print_current();
                                        
return;
                                }
                        }
                }
        }
        function 
store_load() {
                
$this->last_user $this->user;
                
$this->last_nice $this->nice;
                
$this->last_system $this->system;
                
$this->last_idle $this->idle;
        }
        function 
save_load() {
                
$this->store_load();
                
$fp = @fopen(TEMP_PATH."cpuinfo.tmp","w");
                if (
$fp) {
                        
fwrite($fp,time()."\n");
                        
fwrite($fp,$this->last_user." ".$this->last_nice." ".$this->last_system." ".$this->last_idle."\n");
                        
fwrite($fp,$this->load["user"]." ".$this->load["nice"]." ".$this->load["system"]." ".$this->load["idle"]." ".$this->load["cpu"]."\n");
                        
fclose($fp);
                }
        }

        function 
load_load() {
                
$fp = @fopen(TEMP_PATH."cpuinfo.tmp","r");
                if (
$fp) {
                        
$lines explode("\n",fread($fp,1024));

                        
$this->lasttime $lines[0];
                        list(
$this->last_user,$this->last_nice,$this->last_system,$this->last_idle) = explode(" ",$lines[1]);
                        list(
$this->load["user"],$this->load["nice"],$this->load["system"],$this->load["idle"],$this->load["cpu"]) = explode(" ",$lines[2]);
                        
fclose($fp);
                } else {
                        
$this->lasttime time() - 60;
                        
$this->last_user $this->last_nice $this->last_system $this->last_idle 0;
                        
$this->user $this->nice $this->system $this->idle 0;
                }
        }

        function 
calculate_load() {
                
//$this->print_current();

                
$d_user $this->user $this->last_user;
                
$d_nice $this->nice $this->last_nice;
                
$d_system $this->system $this->last_system;
                
$d_idle $this->idle $this->last_idle;

                
//printf("Delta - User: %f  Nice: %f  System: %f  Idle: %f<br>",$d_user,$d_nice,$d_system,$d_idle);

                
$total=$d_user+$d_nice+$d_system+$d_idle;
                if (
$total<1$total=1;
                
$scale 100.0/$total;

                
$cpu_load = ($d_user+$d_nice+$d_system)*$scale;
                
$this->load["user"] = $d_user*$scale;
                
$this->load["nice"] = $d_nice*$scale;
                
$this->load["system"] = $d_system*$scale;
                
$this->load["idle"] = $d_idle*$scale;
                
$this->load["cpu"] = ($d_user+$d_nice+$d_system)*$scale;
        }

        function 
print_current() {
                
printf("Current load tickers - User: %f  Nice: %f  System: %f  Idle: %f<br>",
                        
$this->user,
                        
$this->nice,
                        
$this->system,
                        
$this->idle
                
);
        }
        function 
print_load() {
                
printf("User: %.1f%% <br> Nice: %.1f%% <br> System: %.1f%% <br> Idle: %.1f%% <br> Load: %.1f%%<br>",
                        
$this->load["user"],
                        
$this->load["nice"],
                        
$this->load["system"],
                        
$this->load["idle"],
                        
$this->load["cpu"]
                );
        }
        function 
sample_load($interval=1) {
                
$this->check_load();
                
$this->store_load();
                
sleep($interval);
                
$this->check_load();
                
$this->calculate_load();
        }
        function 
get_load($fastest_sample=4) {
                
$this->load_load();
                
$this->cached = (time()-$this->lasttime);
                if (
$this->cached>=$fastest_sample) {
                        
$this->check_load();
                        
$this->calculate_load();
                        
$this->save_load();
                }
        }
}

$cpuload = new CPULoad();
$cpuload->get_load();
$cpuload->print_load();

echo 
"The average CPU load is: ".$cpuload->load["cpu"]."%<br>\n";
?>
Uptime monitor:
PHP Code:
<?php
$uptime 
shell_exec("cut -d. -f1 /proc/uptime");
$days floor($uptime/60/60/24);
$hours $uptime/60/60%24;
$mins $uptime/60%60;
$secs $uptime%60;
echo 
"This server is up $days days $hours hours $mins minutes and $secs seconds";
?>
Or you can find a wonderful ready-made script here [Save it as "vpsinfo.php" & upload to your VPS]: LabradorData.txt

Do let us know if you need any further assistance..
__________________

Rock _a.k.a._ Jack
Windows Hosting || Windows Reseller Hosting
Cloud Hosting 100% UPTIME! || Powerful Dedicated Servers
Follow eUKhost on Twitter || Join eUKhost Community on Facebook

For complaints, grievances or suggestions kindly email our FeedBack Dept.
Proper action will be taken accordingly & instantaneously!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 24-11-2009, 09:31
Member
 
Join Date: Apr 2009
Posts: 33
Default

Great thread, I've been wondering exactly the same thing myself!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 24-11-2009, 10:35
Senior Member
 
Join Date: May 2008
Posts: 259
Default

you could always try this

Server Statistics - Status2K

have to pay but not expensive and if I recall you can monitor multiple servers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 24-11-2009, 12:23
Member
 
Join Date: Dec 2008
Posts: 33
Default

Brilliant!!!, thank you rock, thats perfect,

and also Lance, nice find too, looks like it works really well on the iphone. There really seems to be an app for everything.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 24-11-2009, 13:25
Rock's Avatar
Technical Support (eUKhost.com)
 
Join Date: Oct 2006
Location: localhost
Posts: 3,356
Send a message via MSN to Rock Send a message via Skype™ to Rock
Smile

Quote:
Originally Posted by baxtermedia View Post
Great thread, I've been wondering exactly the same thing myself!
Glad that you've found this useful
Quote:
Originally Posted by Lance View Post
you could always try this

Server Statistics - Status2K

have to pay but not expensive and if I recall you can monitor multiple servers
That's a wonderful find, Lance, thank you for sharing. I hope others find it helpful too
Quote:
Originally Posted by sam_m08 View Post
Brilliant!!!, thank you rock, thats perfect,

and also Lance, nice find too, looks like it works really well on the iphone. There really seems to be an app for everything.
You're welcome Sam It's always been a pleasure sharing ideas for me..
__________________

Rock _a.k.a._ Jack
Windows Hosting || Windows Reseller Hosting
Cloud Hosting 100% UPTIME! || Powerful Dedicated Servers
Follow eUKhost on Twitter || Join eUKhost Community on Facebook

For complaints, grievances or suggestions kindly email our FeedBack Dept.
Proper action will be taken accordingly & instantaneously!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 24-11-2009, 20:35
Senior Member
 
Join Date: May 2008
Posts: 259
Default

your welcome, used this in the past.... nice and handy, hope it works well for you if you decide to use it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT. The time now is 22:34.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
UK Web Hosting by eUKHosting 3.1.0
UK Web Hosting by eUKHosting 3.1.0
Copyright © 2001-2012, eUKhost LTD. All rights reserved.

 


UK VPS Hosting
VPS Hosting plans

Dedicated Server Hosting
Dedicated Server plans

VoIP Dedicated Servers
Asterisk, Trixbox Dedicated Servers

Business Web Hosting
100% uptime Hosting

UK Cpanel Hosting
cPanel Shared Hosting

Domain Hosting
Cheap Domains & Hosting Plans

UK Reseller Hosting
Reseller Web Hosting

Windows Hosting
Windows Shared Hosting

Windows VPS

Windows VPS Hosting

Semi Dedicated Servers
Semi-Dedicated Hosting

Dedicated Server Mirroring
Dedicated Server Mirroring

Webhosting Knowledgebase
Frequently asked Questions

Web Hosting Blog
eUKhost Blog

Web Hosting Support
Support Helpdesk

UK Data Center
eUKhost Datacenter

Web Hosting Forum
eUKhost Forum

Support Tutorials
Online Flash Tutorials

Offsite Back-up Plans
Remote Backup Service

ColdFusion Hosting
ColdFusion Web Hosting
 
 

Android and Apple App


knowledgebase articles
eUKhost.com Services

Pre-Sales Questions
Pre-sales FAQ's

Domain Names
Domain registration FAQ's

cPanel Hosting
cPanel Hosting FAQ's

Windows Web Hosting
Plesk Control Panel

Reseller Hosting
Reseller Hosting FAQ's

VPS Hosting
Virtual Private Server

Semi-Dedicated Servers
Semi-Dedicated FAQ's

Dedicated Servers
Dedicated Server Hosting

Joomla Hosting
Joomla Web Hosting

Mambo Hosting
Mambo Web Hosting

Magento Hosting
Magento Web Hosting

Wordpress Hosting
Wordpress Web Hosting

 

Web Hosting Affiliate Program
 

popular blog categories

UK Web Hosting
UK Hosting articles

Dedicated Server Hosting
Dedicated Server guidelines

VPS Hosting
VPS hosting articles

cPanel Hosting
cPanel Hosting articles

Linux Operating System
Linux Operating techniques

Windows Web Hosting
Windows plesk articles