July
20061:21 pm
Service availability script
A while back I realized my current server monitoring scripts were not doing enough to alert me when something went wrong, so I modified the existing script I was using to do more for my situation. Yesterday I decided I liked it so much that I should share… So in case you are looking for something like this, read on to see if it will meet your needs and feel free to download it and use/modify it for your own server(s).
I had been using a very simple script called hostchecker.pl for some time now, with a few modifications to do more of what I needed. After looking around lately for something similar, I wasn’t able to find anything that was as small and simple as this. I have 3 FreeBSD boxes on seperate networks, in seperate locations running secondary DNS and mail, and also as a small external monitoring network for my services at SSA Host and SSA Phone to alert me if one of the servers I host my customers on, or the services running on those servers fail to respond.
While this script was great for what it was: A light, simple, fast, and free monitoring script. It wouldn’t help me if a service was responding incorrectly. For example, it would connect to a mailserver to verify that the server and service were running, but that was it. If the mailserver were responding with an error and not accepting email, I would not know about it. Thats when I started adding my modifications to include curl and string verification. In addition to simple pings to your servers, you can also setup services with expected return values, and if the script doesn’t receive that string when connecting to your server, it will trigger an email alert.
The script uses Perl with Net::Ping and will also need curl installed on the server. The configuration file needs to be in /etc and modified to include the servers and services you want to monitor as well as what email addresses to notify in case of failure. After that, you’re ready to go! No big bloated install, just 2 files.
You can download the script from: www.sirkels.com/software.php (4.53KB)
http://violag.myopenid.com/
Geek Things, Projects
RSS feed
Link

RSS / Feeds






[...] I realize it’s been a while again since I last updated my blog, but I have another good excuse. (don’t I always) I spent last weekend updating dns naming schemes to accomodate adding an additional server to my Web Hosting Service. I also setup 3 backup mail servers to handle email for my customers in a store-and-forward fashion should their mailserver be unreachable. I modified the service availability script I previously mentioned even further to act as external monitoring on 4 seperate servers to alert myself and technicians of any issues with either webserver or any of the 3 backup mail servers. The script will not only notify pagers and cellphones but will update a web page with the current status. I even had time after that to rearrange my living room, clean half of the apartment, and help my mom get a new house! [...]