PDA

View Full Version : My Server Info in AdminCP


Dream
07-17-2005, 10:00 PM
This is a script that I used outside the admincp, that shows some server info.

- Shows server time with exec(date)
- Shows server load with file_get_contents("/proc/loadavg") (same as microstats plugin)
- Shows memory usage with exec(free)
- Shows free disk space with exec(df)
- phpinfo() link
- Shows MySQL Stats with mysql_stat()
- Shows MySQL Status with "SHOW STATUS" query
- Shows MySQL Vars with "SHOW VARIABLES" query

Its superadmin only.

Installation
- Upload "server_info.php" to your admincp
- Upload "cpnav_serverinfo.xml" to your includes/xml
- Reload your AdminCP, its under "Server Info"

jesus likes pie
07-18-2005, 01:51 PM
ooooh

jesus likes pie
07-18-2005, 03:26 PM
O.K works fine. One question..


Server Load file_get_contents("/proc/loadavg")

failed

whats that mean? Is something wrong with my server?

MrNase
07-18-2005, 08:58 PM
Are you running Linux?

Are you sure the 'loadavg' in the folder 'proc' exists?

Chris M
07-18-2005, 11:22 PM
If you don't have proc, replace in server_info.php:
$loadavg = @file_get_contents("/proc/loadavg");
if ($loadavg) {
$regs = explode(" ",$loadavg);
$serverload='Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2];
} else {
$serverload = 'failed';
}
with:
if ($loadavg = @file_get_contents("/proc/loadavg")) {

$regs = explode(" ",$loadavg);
$serverload = 'Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2];

}elseif ($stats=@exec('uptime')) {

preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
$serverload = 'Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2];

}
That should work :)

Edit: Yes that does work :)

Satan

Dream
07-19-2005, 12:11 AM
thanks satan can I use that in an update?

and does anyone know the best way to get "server memory usage" and "disk space used/free"?

Chris M
07-19-2005, 12:47 AM
thanks satan can I use that in an update?

and does anyone know the best way to get "server memory usage" and "disk space used/free"?

Sure you can - You may want to play about with it though :)

For server memory usage, try looking at the php function "memory_get_usage" :)

Satan

utw-Mephisto
08-17-2005, 06:24 AM
Works smoothly :)

Chrissicom
10-18-2005, 07:53 AM
Any way to make this work on Windows 2003??

gsm4arab1
10-18-2005, 09:52 AM
thanks jesus likes pie

Kihon Kata
10-18-2005, 12:35 PM
ooooh

Fatal error: Call to undefined function: rpm_print_stop_back() in /home/httpd/vhosts/makeuptalk.com/httpdocs/forums/admincp/server_info.php on line 17

Yes, I am running Fedora

Any Ideas?

ideenwerk
10-21-2005, 08:14 AM
Works fine and is very useful, thanks! :up:

Flow Fusion
10-21-2005, 12:57 PM
Thanks.

eXtremeTim
10-29-2005, 04:15 AM
umm yea


rpm_print_stop_back


when you use a function its usualy nicer if its a real function that is defined.

Anybody who doesnt have permission to view the page will get that nice error tony was having.

Boofo
11-29-2005, 02:31 PM
My site went down last night due to the var dir getting filled up with logs, apparently. I was told by the Host that this hack could cause that. I want to check and see if anyone else has run into this before I remove anything.

The strange thing is that I have only run this once since moving to the new serever and it was yesterday, a little while before I got the "too many connections" error.

Anyone have any ideas on this?

puertoblack2003
11-29-2005, 02:41 PM
My site went down last night due to the var dir getting filled up with logs, apparently. I was told by the Host that this hack could cause that. I want to check and see if anyone else has run into this before I remove anything.

The strange thing is that I have only run this once since moving to the new serever and it was yesterday, a little while before I got the "too many connections" error.

Anyone have any ideas on this?

hey boofo that's the problem i was having i deleted the file to see wat happen so far everything been stable as of today...i was going every where looking to see what hack caused the problem i later found out the only one will be this hack... :ermm: :rolleyes:

Boofo
11-29-2005, 02:42 PM
hey boofo that's the problem i was having i deleted the file to see wat happen so far everything been stable as of today...i was going every where looking to see what hack caused the problem i later found out the only one will be this hack... :ermm: :rolleyes:

What file did you delete?

puertoblack2003
11-29-2005, 02:46 PM
What file did you delete?

the installation file server.php and xml

Boofo
11-29-2005, 02:48 PM
the installation file server.php and xml

Ok, thanks and hopefully someone can come up with a reason why this is happening and a possible fix for it. I really like this hack. :(

puertoblack2003
11-29-2005, 02:52 PM
Ok, thanks and hopefully someone can come up with a reason why this is happening and a possible fix for it. I really like this hack. :(

yes sir, i myself like it hope they fix it as well... :rolleyes:

Diana Notacat
12-12-2005, 08:10 PM
Just bumping to see if anyone has found out about that server load problem yet! This hack would be wonderfully useful! :D

AWI
12-21-2005, 12:36 PM
Installed on 3.5.2 and all is good. Thanks

kabir
04-19-2010, 12:25 PM
Fatal error: Call to undefined function rpm_print_stop_back() in /home/mygsmbd/public_html/admincp/server_info.php on line 17

whats problem

Dream
04-20-2010, 02:27 AM
I still use this on vb 4 with no problems.