Monthly Archive for January, 2010

Bash Linux server monitoring script

Part of my day-job is based around monitoring a business critical group of servers at work, so it seemed natural to try and implement some monitoring on a server I help look after for LSU CompSoc.

Given the major differences between the two environments and their importance, I thought a basic shell script should do the job for now (tested on Ubuntu 8.04.3 LTS).  The check’s I’ve implemented are Disk space checks, NIC errors, user changes (add/delete), package check, and checks for apache & mysql.  Also I’ve made sure that the script will run as a normal user so no need for sudo access to anything.

I’ve attached the script incase anyone else finds it of use  (You’ll need to modify the settings section as appropriate for your own server and create the relevant paths referenced in the settings.  The script is also dependent on this Perl SMTP CLI mailer (you’ll need to download a copy onto your server).  I plan to modify the script to support other mail methods but at present it just does what I needed from it.

I’ve also got another script to notify of any reboots and will add that here shortly.

Bash Monitoring Script (500)