As part of keeping an eye on my support systems, I’ve been using a script for my Casper servers running on Linux which emails me a status report on a daily basis. I adapted this script from an earlier one I wrote to monitor Tomcat and alert me if Tomcat was having issues. The script tells me a number of things that are useful to know, including the following:
- Uptime
- Free space on all attached drives
- Who’s logged in via SSH or in the console
- Virtual memory statistics
- Current system tasks
- SMB connections information
- Recent entries in the Apache server logs
- Recent entries in the JSS server log
In my case, my Casper servers are hosted on Red Hat Enterprise Linux so I’ve focused this script’s development and testing on compatibility with RHEL-based Linux distributions. That said, nothing in it is RHEL-specific so it should also work on other Linux distributions. For more information, see below the jump.
Compatibility:
This script has been tested on the following Linux distributions:
- Red Hat Enterprise Linux 6.x
- CentOS 6.x
Script location:
The scripts are stored in /scripts on both my Casper production and Casper test servers. I created this directory, you can use whatever directory you prefer.
Crontab:
The following entry has been added to the root crontab in order to send a daily report at 10:00 PM
0 22 * * * /scripts/casper_server_report.sh 2>&1 >> /dev/null
Permissions for the scripts:
Change permissions on casper_server_report.sh to match the following:
Owner – root (r/w/x)
Group – wheel (r/x)
Everyone (r/x)
The script is available below. It is also available on GitHub at the following address: