Nagios Alerts via SMS with Kapow

I have a client who required a Nagios installation with alerting via SMS (*). They use Kapow as their SMS gateway.

There were two aspects required:

  1. The sending of alerts via the SMS gateway;
  2. The monitoring of available credits on the SMS gateway;


1. Send Alerts via SMS Gateway

The sendsms script is:

I use a quick hack with PHP to URL encode the string. I didn’t know a shell command off hand but I’m open to suggestions. This can be tested with:

Edit /etc/nagios/misccommands.cfg to include the following:

Ensure your /etc/nagios/contacts.cfg is updated to include notification by SMS with your mobile number:

Sin é.


2. Monitor SMS Gateway Credits

The plugin code is:

Create a plugin configuration file for Nagios, say /etc/nagios-plugins/config/sms_credits.cfg:

Where $ARG1$ is the warning threshold and $ARG2$ is the critical threshold.

I add the service to the Nagios monitoring box via /etc/nagios/config/sms_credit.cfg:

And I believe that’s it.

*) The monitoring box is in a different country to the servers it monitors so a network failure will not prevent the alert getting out.

8 thoughts on “Nagios Alerts via SMS with Kapow”

  1. Hi!

    Thank you (as well) for the scripts, and taking the time to document it – I was looking for a replacement for using twitter/jaiku, which is too unreliable for monitoring… and finding a decent sms gateway seemed to be a pain. Clearly you made my life very easy 🙂

    My only observation – I had to add ‘–no-check-certificate’ to the wget lines (they failed silently otherwise due to your use of -q).


  2. Thanks for the note David (and Paul).

    I suspect the ‘–no-check-certificate’ was a temporary problem with Kapow as the SSL cert looks good.

    Still, it’s a not a bad idea as one wants to make sure they get their SMS messages.

  3. Thanks for a good walkthrough

    Just added it to our nagios 3 installation and is working fine, subject to minor tweaking on the service names


  4. I know this is not a support forum, but I’m having a problem which has me baffled and you sound like you know what you’re doing so I’m hoping you can help.

    I’ve got the following service command set up:

    define command{
    command_name notify-by-epager

    The curl command calls a SMS gateway we set up on the Nagios server and is tested and working.

    This works fine when the host comes up and reports:

    RECOVERY: MyServer/PING is OK

    When the service goes down, however, some of the variables are missing resulting in a message like the following:

    PROBLEM: MyServer/ is

    The $SERVICEDESC$ and $SERVICESTATE$ variables just don’t show up for the party.

    Any ideas?

Comments are closed.