Making sure all systems are working fine round the clock is very important for us. We use the popular monitoring solution, Nagios, to do the job of alerting us when things are not quite ok. Now, configuring Nagios with email alerts is pretty simple and we set it up with that.
But sometimes, email alerts are simply not good enough – say – a server is experiencing low memory situation in the night. The solution is to have Nagios call up a telephone number for critical alerts. This is where KooKoo comes in.
KooKoo has a web based API for call control. Although most of their services are aimed towards incoming calls, they do have a simple outgoing call feature as well. We wrote a quick shell script – “kookoo_call.sh” which takes the phone number and the message to be delivered. The real task it does is to simply make an HTTP request:
wget --quiet --timeout=10 -t 1 -O /tmp/kookoo_call.$$.out "http://www.kookoo.in/outbound/outbound.php?phone_no=$PHONENUM&api_key=XXX&extra_data=$MESSAGE ... repeating message ... $MESSAGE"
KooKoo uses a decent Text-to-Speech engine which generates the message on the phone call. Still, repeating the message does not hurt – helps you to rub your eyes and become sane enough to understand what is being said 🙂
Next, use this script as a Nagios alert command:
/path/to/kookoo_call.sh -p $CONTACTNUMBER$
-m "Hello Nagios alert $NOTIFICATIONTYPE$ Host $HOSTALIAS$ Service $SERVICEDESC$ is $SERVICESTATE$"
Voila! We now get a phone call on critical system alerts. Of course, we still have to make sure our on-call mobile phone is charged – but that’s another story 😛