Some time ago I found it pretty useful to configure Nagios monitoring system to send me a phone call in case of some critical problem. If some mission critical application goes down at night most probably you’ll miss an e-mail or sms notifying about that but won’t miss a telephone call to your cell phone. Honestly a telephone call is much more notorious rather than IM message notification or, again, e-mail/sms. You’re welcome to see below how to configure your Nagios for that.

First of all you need to have account at some SIP voip service provider like or similar (Skype is not an option so far). Once registered you will get SIP username/password and SIP gateway’s IP address which will be used to make outgoing calls by Nagios.

1. Download and install pjsua console caller from pjsip.

cd /usr/src/
tar -xvjf pjproject-1.10.tar.bz2
cd /usr/src/pjproject-1.10
./configure --disable-sound
sudo cp pjsip-apps/bin/pjsua-i686-pc-linux-gnu /usr/bin/pjsua

2. Configure pjsua.

Create /etc/pjsuarc configuration file with the following contents (depends on details provided by SIP provider):

--registrar sip::5060
--id sip:<username>@<SIP gateway IP>:5060
--username <username>
--password <password>

From that point you can try calling yourself by command:

/usr/bin/pjsua --config-file=/etc/pjsuarc sip:<your phone number>@<SIP gateway IP>

3. Configure Nagios to notify you by sending you a telephone call:

Add the following block to Nagios’ commands.cfg:

define command{
        command_name  notify-host-by-sip
        command_line  (sleep 30 && echo q) | /usr/bin/pjsua --config-file=/etc/pjsuarc sip:$CONTACTEMAIL$

Add below contact to Nagios’ contact.cfg:

define contact{
        contact_name  user_sip
        alias  useralias
        service_notification_period  24x7
        host_notification_period  24x7
        service_notification_options  c
        host_notification_options  d
        service_notification_commands  notify-service-by-sip
        host_notification_commands  notify-host-by-sip
        email  <your phone number>@<SIP gateway IP>

That’s it, from this point Nagios will call you in case of critical problem and won’t bother you with warnings.




  1. Pingback : Top 5 Linux Monitoring Tools. Web Based. | TechFeeder

  2. March 30, 2012  5:07 pm by fruit mocking party Reply

    Have you ever thought about adding a little bit more than just your articles? I mean, what you say is valuable and everything. Nevertheless imagine if you added some great photos or videos to give your posts more, "pop"! Your content is excellent but with images and clips, this website could definitely be one of the very best in its niche. Awesome blog!

  3. April 25, 2012  6:19 pm by Steve furniss Reply

    I wonder if you can give me an example of using pjsip to dail a landline number via a sip provider?



  4. May 23, 2012  9:28 pm by Barry Reply

    Any ideas how I would accomplish sending nagios alerts via phone and/or text using a sip gateway such as GOIP gsm gateway?

  5. July 20, 2012  12:50 am by Auction Goods Reply

    I just could not go away your web site before suggesting that I extremely enjoyed the usual information a person provide for your visitors? Is gonna be again continuously to investigate cross-check new posts

  6. July 24, 2012  5:35 pm by IB Reply

    Or you could just use PagerDuty...

  7. July 26, 2012  1:30 am by Philip Reply

    Cool, but what does the phone call say? I can understand email/sms/IM but what do you hear when you pick up the phone?

  8. Pingback : Linux Monitoring Tools. Web Based. | general linux, admin linux, admin network

  9. Pingback : Top 5 Linux Monitoring Tools: Web Based « Ubuntu Arena..!

  10. January 10, 2013  7:28 am by Arun Shetty Reply

    We have a working implementation of asterisk in our environment that I've tried to leverage to make phone calls for critical service failure alerts. Unfortunately I haven't been able to have NAGIOS make the calls, though I've been able to successfully place the calls by manually entering the following line in the shell prompt:

    /usr/bin/pjsua --config-file=/etc/pjsuarc sip:@

    In addition to the steps provided by you, I've done the following:

    -> defined host directive in templates.cfg
    -> defined service directive in templates.cfg
    -> defined contact and contact group directives in contacts.cfg
    -> defined the host/service configurations to use the host/service templates created before

    Am I missing anything?

  11. Pingback : Delicious Bookmarks for March 5th from 13:22 to 15:43 « Lâmôlabs

  12. March 22, 2013  9:16 pm by book flights ticket Reply

    Have you ever thought about writing an ebook or guest authoring on other blogs? I have a blog based upon on the same subjects you discuss and would really like to have you share some stories/information. I know my viewers would value your work. If you're even remotely interested, feel free to send me an email.| book flights ticket

Leave a reply


Your email address will not be published.