Hello Everyone,
Here is my question:
1. Nagios is set up but still can't send email to the user via sendmail. Here is the log message got from /var/log/maillog
Oct 19 14:35:34 IFS-NAGIOS sendmail[31959]: t9J6ZYrV031959: to=$, ctladdr=nagios (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30461, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
You see to=$, that is the main point.
2. If I use sendmail manually to send email, it's ok. Like:
echo test | mail -s test [email protected]
3. If I use following command, it's ok.
/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$ **" [email protected]
4. If I use following command, it doesn't work.
/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$
Summary: $CONTACTEMAIL$ this macro doesn't work.
How to fix it ?
Reboot system --- No go
Restart Nagios --- No go
Reinstall Nagios --- No go
Reinstall system and reinstall nagios --- No go
Nagios can't send E-mail to the user when it gets alert
-
houjun19830610
- Posts: 1
- Joined: Mon Oct 19, 2015 1:31 am
Re: Nagios can't send E-mail to the user when it gets alert
Going to need some information:
- What version of Nagios are you using?
- What OS are you installing it on?
- How are you installing Nagios? (Source/repository)
Former Nagios Employee.
me.
me.
Re: Nagios can't send E-mail to the user when it gets alert
Did you change the email in contacts.cfg?
Nagios takes the email from there if I'm not wrong.
Code: Select all
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
Re: Nagios can't send E-mail to the user when it gets alert
If that is the contact you're using for that service check, yeah, that is where it will take it from.
Former Nagios Employee.
me.
me.