Script for creating server status email reports.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LICENSE Update README and add LICENSE. Sep 4, 2012 Update README and add LICENSE. Sep 4, 2012
status.rb Reduced column count. Feb 15, 2010


Oftentimes you might be interested in the status of your server without having to actually sit there staring at a terminal window. Wouldn't it be nice if you could run a script to email you information about the state of your server? Well, that's exactly what this script does. It outputs HTML 4.01 Strict compliant content containing information on your server including:

  • load average
  • memory usage
  • open network connections
  • top 10 memory processes
  • top 10 CPU processes
  • netstat output
  • top snapshot of all running processes

This script was primarily written for and tested on DreamHost Private Servers.


To install this script, the first thing you want to do is download a copy of the script to use. To do that, SSH to your server under the user you want to run the script as and run this command:

git clone git://

The script itself is written in Ruby to take advantage of the {ERB templating system}[] to produce the HTML content.

Once you've downloaded the script successfully, you need to make sure that the mailx package is installed on your server. To find out, run this command:

dpkg -l | grep mailx

If you see output like this:

ii  mailx                     8.1.2-0.20050715cvs-1        A simple mail user agent

then that means it's installed. If instead you see output like this:

rc  mailx                     8.1.2-0.20050715cvs-1        A simple mail user agent

then that means you need to install it. To do so, login with an admin with sudo privileges and run the following command:

sudo apt-get install mailx

Now you're ready to create a cron job to send yourself your status report. The command you want to run is as follows:

/usr/bin/ruby /path/to/script/status.rb | /usr/bin/mail -a "Content-type: text/html;" -s "Status Report: $HOSTNAME" ""

You can change the subject to whatever you want and just replace with the address you want the email sent to. If you want to CC the email to more email addresses you can use the -c flag and pass it a comma separated list of email addresses. Running it once per hour is probably not a bad idea, but you can run it as frequently or infrequently as you like!


If you set everything up properly, then you should start getting emails that look roughly like this:

Keep in mind that this script will likely be updated as time progresses. So, if this stops working for you, be sure to check back to see if the script has been updated.


Copyright (c) 2012 Joel Watson. See LICENSE for details.