Tutorial

A simple script to check your server status.

Ever wanted to find out information about your server like what your current memory usage is? Disk usage? What type of processor you have? Here are some basic codes that will help you with 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>

Simply copy and paste in any text editor like notepad and name it anything you want with a .php extension.

You can upload the file anywhere you want and remove it when you are done.

Or if you would like to keep the file around and protect the file so only you can see it you can add a check for your Dolphin Admin Password so you will only be able to view and access the file if or when you are logged into your Admin Panel.

Simply add to the file:

<?php
require_once( '../inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'admin.inc.php' );

$logged['admin'] = member_auth( 1, true, true );
?>




So the entire file would look like:

<?php
require_once( '../inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'admin.inc.php' );

$logged['admin'] = member_auth( 1, true, true );
?>
<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>

This will prompt you for you Dolphin Admin Panel Password before you are allowed to view the file. So first login, then enter the address into your web browser.

You could also integrate it into your Dolphin Admin Panel so the output would be inside your Dolphin Admin Panel, or simply add the link to the file in your Admin Panel.

If you would like to download the file without the Admin Panel Password Protection:
serverstatus without password protection

serverstatus with password protection

It's nothing fancy, but it will output information about your server like what your server's current memory usage is. What type of processor you have. Even disk usage. If you are on shared hosting it will be the entire server not just your account, which is kind of interesting.


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

Sample Screen Shot:

Server Status

 
Written By
Tutorial by: Jeremy LeSarge (AKA Ray)

I am the owner and administrator of DialMe.com. I write Tutorials for Boonex Dolphin as well as tips and resources surrounding website programming and development. I enjoy working with WordPress, SEO, and Web Hosting / Servers. I also maintain a WordPress Blog here on this site where you will find a variety of technology and webmaster resources.

Actions
Recommend
Sponsored Links