16

I have a couple of nagios servers that currently alert me via SMS and email, but I'd like to add outgoing calls to that. The ideal solution would have the nagios machines call my cellphone and play an mp3/wav across the call to let me know something is wrong. My only problem is that I'm not sure how to go about accomplishing this.

I suspect I may have to buy a PBX card to do it, but I was hoping that someone here had done something similar with a regular modem and off-the-shelf software. Any ideas or hints?

Matt Simmons
  • 20,218
  • 10
  • 67
  • 114
  • 1
    Make it call your admins at 3am with modem noises. That'll teach em to set up systems properly! – pauska Sep 19 '12 at 06:21

8 Answers8

12

Asterisk is overkill - but would work without issue. Save some time and get a voice capable modem and use vgetty.

Here is a tutorial which shows an 11 line perl script for playing a message over an outbound call:

http://www.webreference.com/perl/tutorial/14/2.html

Steven
  • 3,009
  • 18
  • 18
  • The vgetty documentation has the missing parts of the programs and procedure to create the voice files. It also has examples that just use shell script instead of Perl. – Allen Jun 07 '09 at 16:48
  • 2
    Many well meaning posters below are recommending SIP or asterisk configurations. Asterisk is wonderful, but may be overkill here considering I think you really want to use an actual modem if possible. That way, even if your network is offline (something you would want to be notified about) you will still get the notification. – Kyle Jun 07 '09 at 21:10
4

You should look into Asterisk, an open-source PBX

http://www.asterisk.org/

You might want to look at the pre-bundled distributions rather than starting from scratch, as Asterisk is quite configurable and can be daunting to the newcomer at a low level (much like Apache httpd).

To send the alerts you describe, I'd suggest using the spool file configuration. Build a dialplan that when invoked dials the appropriate number and plays the right file. Once that's working, you can drop files into an Asterisk directory which will cause that portion of your dialplan to be invoked. You can pass parameters and such in the spool files, so you wouldn't have to create each message from scratch - you could have it read out the server letter-by-letter or use the integration to several TTS engines to try to say the server name.

You will need outbound termination to get the call out onto the PSTN, but there are many providers of such services. Most offer pricing where you pay a small standing charge for the account and then a low (on the order of cents per minute) outbound call charge.

Hope that helps.

James F
  • 6,549
  • 1
  • 25
  • 23
3

If you're still looking for a solution, you might want to take a look at PagerDuty. PagerDuty will collect alerts from any monitoring system that can send e-mails (including Nagios) and place phone calls and SMS messages to a list of people you provide. It also lets you build on-call schedules and escalation chains.

http://www.pagerduty.com

[Disclaimer: I'm one of the people working on PagerDuty, so I might be a tad biased :P]

  • Cool. The only problem with this is that if I need to make calls because my network connection is gone, I can't get to pagerduty. chicken / egg ;-) Neat, though. Thanks! – Matt Simmons Jun 19 '09 at 03:13
  • 2
    Yeah, that is a bit of a problem with the system. One possibility is to add a PagerDuty alarm that triggers on some ping service. I like BasicState (http://basicstate.com/) (it's free), but Pingdom and Pingability are both good choices too. That way, you get alerts on both network failure, as well as faults that Nagios detects. But yeah... we want to get a ping test or heartbeat monitor built into PagerDuty sometime soon. – Andrew Miklas Jun 19 '09 at 03:20
2

Have a look at nagast. That will call you in case of issues and report the ack back to nagios. Also, it will create a call if the nagiosbox didn't ping (not icmp, but nagast-ping) for a certain time. https://github.com/tuxis-ie/nagast

1

I'm not sure about the dialing out bit, but I reckon you could use festival to do the text to voice synthesis part of it.

http://www.cstr.ed.ac.uk/projects/festival/

Dave Wongillies
  • 462
  • 4
  • 8
0

maybe sip command line client like one described here would be helpful? it very much depends what you monitor, how reliable your sip provider would be and so on. still i have more trust in hardware sms gateway. assuming you do not monitor internet access infrastructure or your nagios server has separate independent internet connection - this could actually work.

pQd
  • 29,561
  • 5
  • 64
  • 106
0

If you're comfortable coding up a little plugin yourself, Twilio offers a powerful and exceedingly easy to implement API for making calls with text-to-speech, user input, voice recording, etc.

ceejayoz
  • 32,469
  • 7
  • 81
  • 105
0

There are services such as email2phone that will convert email messages into phone calls. These are generally trivial to setup, and wouldn't require changes to your Nagios setup other than adding a new email address. You're somewhat limited in what you can do, but for a quick solution it might work for you. If you want more flexibility and have some development skills, Twilio would also be a good option.

Both of these, as well as local sip-based options, will have problems if you have a complete loss of connectivity. To handle that, you would need to either have a separate connection for notification (such as a PSTN line) or use Nagios along with a third-party monitoring service to alert you to total connectivity loss.

Jason Abate
  • 441
  • 4
  • 3
  • We've got a primary site and a secondary site, and the nagios machines at each site watch each other (the the other sites' links). Thanks! – Matt Simmons Jun 07 '09 at 19:53