HOW TO CONFIGURE EMAIL & SMS ALERT

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
nagiosnandha
Posts: 8
Joined: Thu Nov 07, 2013 2:06 am

HOW TO CONFIGURE EMAIL & SMS ALERT

Post by nagiosnandha »

Dear All,

I have configured nagios core in my concern, its working fine. may i know the steps to configure email and sms alert on Nagios.

--
Regards,
Nantha
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by MPIvan »

Hi,

Firs you have to choose one of the mail clients ( i for example use postfix ) and i have configured to work as null client, just to send mails not receive. But this is you choice. After that you have to configure command.cfg files, find the "notify-host-by-email" part and change the path to the mail service.

Code: Select all

# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }
After that you have to configure the contacts in contacts.cfg file, to define contacts, for example:
define contact{
use generic-contact
contact_name nagiosnandha
alias Nagios
email yourusername@yourdomain.com
}
and the final part is to add this contact to one of the services or hosts depending of how and for what you would like to receive mail.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by abrist »

Just to add on to MPIvan's post:
Most people send sms through their carriers email gateway. A few use sms modems. If you wish to just send to a mobile carriers email gateway, you will need to find out their email gateway server hostname and send the notifications to the gateway. Most carriers use your phone number for the email address username, while others do not. You may have to do some research on what your carrier provides.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
nagiosnandha
Posts: 8
Joined: Thu Nov 07, 2013 2:06 am

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by nagiosnandha »

Hi,

Can i configure that in gmail or yahoo

--
Regards.
Nantha
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by slansing »

Well, you can send notifications there, yes. You can use sendmail or SMTP for this.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by tmcdonald »

Nagios doesn't have any bias for one email provider or another, so yes you can do this for gmail or yahoo,
Former Nagios employee
nagiosnandha
Posts: 8
Joined: Thu Nov 07, 2013 2:06 am

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by nagiosnandha »

Hi,

I tried but its not working, please send that configuration.

--
Regards,
Nanthakumar.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by tmcdonald »

Please send what configuration?
Former Nagios employee
nagiosnandha
Posts: 8
Joined: Thu Nov 07, 2013 2:06 am

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by nagiosnandha »

for email alert. ie) contact.cfg
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: HOW TO CONFIGURE EMAIL & SMS ALERT

Post by tmcdonald »

I'm a little confused. Do you want to see my contacts.cfg?

Are you trying to get gmail/yahoo addresses working? What specifically is not working?
Former Nagios employee
Locked