Advanced server information
By: Daniel

Ever want to find out information about your server like what your current memory usage is? What type of processor you have? Even disk usage? Here are some basic codes that will help you with all of that:

<pre>
<b>Uptime:</b>
<?php system("uptime"); ?>

<b>System Information:</b>
<?php system("uname -a"); ?>

<b>Memory Usage (MB):</b>
<?php system("free -m"); ?>

<b>Disk Usage:</b>
<?php system("df -h"); ?>

<b>CPU Information:</b>
<?php system("cat /proc/cpuinfo | grep \"model name\\|processor\""); ?>
</pre>

Your server must be a linux server and allow the system() function to be called in php.

Sample output:

Uptime:
21:39:36 up 2 days, 1:08, 0 users, load average: 0.00, 0.00, 0.00

System Information:
Linux danserv 2.6.12-10-386 #1 Mon Jun 12 22:04:42 UTC 2006 i686 GNU/Linux

Memory Usage (MB):
total used free shared buffers cached
Mem: 306 293 12 0 147 33
-/+ buffers/cache: 112 194
Swap: 713 9 704

Disk Usage:
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 5.2G 919M 4.0G 19% /
tmpfs 154M 0 154M 0% /dev/shm
tmpfs 154M 13M 141M 9% /lib/modules/2.6.12-10-386/volatile
/dev/hda1 67M 19M 45M 30% /boot
/dev/hdb1 74G 56G 14G 81% /files

CPU Information:
processor : 0
model name : VIA Nehemiah

*The above was taken from my local testing server so you could see a sample output.

Enjoy!

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading ... Loading ...

2 Responses to “Advanced server information”

  1. Tony Says:

    Thanks again . i sure like this one . come to find out the server im on . i dident realize has 7 cpu’s running @ 1.6 ghz :) . is there more code that can pull more info from the server ?

    Thanks again :)

  2. bazish Says:

    Thanks for sharing this another good script. i used it to display information on pages, which looks good.

Leave a Reply

geovisitors