Creating Nagios email notifications
Creating Nagios email notifications
Hey there! I need to set up nagios email notifications and I just need pointed in the right direction on how to configure the email server. Everytime I try to research how to get this done it seems as if every article/website I read is different commands, or different approaches. I am running Nagios on a raspberry Pi. Any information would be really appreciated Im kind of stuck on this and need to get this machine deployed to a local hotel.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Creating Nagios email notifications
Hi,
HOSTS
SERVICES
Those handler are assigned to the contact objects. Since mail serer is outside of Nagios software, we do not have any docs on configuring Sendmail, Postfix, Exim or other MTAs.
Example Test Notificaiton
Hope that helps get you started.
Benjamin
Nagios Core will just use the default MTA on the Linux system. The generic notification handlers are as follows.Hey there! I need to set up nagios email notifications and I just need pointed in the right direction on how to configure the email server.
HOSTS
Code: Select all
/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\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$
Code: Select all
/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Example Test Notificaiton
Code: Select all
su nagios
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: CUSTOM\nHost: TESTEMAIL\nState: DOWN\nAddress: 10.1.17.17\nInfo: CRITICAL - Host Unreachable (10.1.17.17)\n\nDate/Time: Fri Nov 22 15:27:11 CST 2019\n" | /usr/bin/mail -s "** CUSTOM Host Alert: TESTEMAIL is DOWN **" ****@***.com
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!