Is it possible to send a test email to the users of nagios?
My email alerts have suddenly stopped coming even though all the configs are correct
check your /var/mail/nagios file
ls -la /var/mail
is nagios file 0 bytes? If not, then your mail has stopped outputting.
Or, send a test.
command_line /usr/bin/printf “%b” “***** Nagios ***\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /bin/mail -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
So just reproduce a test by substituting values for all the $ stuff. or else you will get just what it says now. i.e. $HOSTALIAS$ etc. change it to hostaliastest etc.
Edited Thu Oct 13 2005, 09:19AM ]
The nagios file is not 0 bytes. It is about 121720 bytes.
[[email protected] root]# /etc/rc.d/init.d/sendmail status
sendmail (pid 24507 1678 1669) is running…
[[email protected] root]# /etc/rc.d/init.d/sendmail restart
Shutting down sendmail: OK ]
Shutting down sm-client: OK ]
Starting sendmail: OK ]
Starting sm-client: OK ]
[[email protected] root]#
If after the restart it’s still not working, then delete all the entries in the file.
remove all lines in the file and then save it.
Or simply delete the file entirely and then touch a new one.
Make sure you check the permissions on the file BEFORE you delete it, and then make changes to it after you touch a new file.
ls -la /var/mail/nagios
chmod 660 /var/mail/nagios
chown nagios.mail /var/mail/nagios
How can i find out which email server is nagios pointing to, to send out the emails.
ps -ef|grep mail
mine says that it’s sendmail that is running.
nagios doesn’t point to anything. All it does is run the command as defined in misccommands.cfg which is the “mail” command.
for more info on mail command.
Sir, does nagios send an email or does it relay it. If it is relaying the alerts then probably my Mail Foundry is blocking it.
still experiencing the same problem
nagios executes the “mail” command. See
man mail for more info on the mail command.
I am using sendmail as the mail transport.
I had one time a mail message that locked up the outgoing mail, so the /var/mail/nagios file just filled up. I deleted it, then touched a new one, and problem was gone.
You may have a firewall turned on, so turn it off, till you figure out how to get by the firewall on the nagios box. It’s most likely SeLinux firewall.
Hello. I did all possible tries for getting email alerts. Turned off the firewall. Checked the /var/mail/nagios, it is 0bytes. The mails are going somewhere but they are not getting delivered.
I also changed an email address to [email protected], which is my pesonal email address still the email did not reach it. I also tried, as someone suggested, by changing the Smart_host in sendmail.mc file to smtp.ispname.com, but still negative results.
Do i need to change my HOSTNAME in /etc/sysconfig/network. Right now the HOSTNAME is localhost.localdomain
Will changing it to nagios.domainname.com help?
You first need to find out if your linux box can run the mail command. Run it by hand.
mail [email protected]
fill in the subject, enter some body text, hit ctrl-d
you should get an email.
if that works, then follow the docs to enable nagios notifications.
This is what i did,
/usr/bin/printf “OUTPUT” | /bin/mail -s ‘HOSTALIAS/SERVICEDESC is SERVICESTATE’ [email protected]
No error message was received and no email has arrived.
Then problem is not in nagios but with your mail setup. I’m not very good with sendmail, but that’s all I did was install sendmail and made no changes to it at all.
rpm -qf /bin/mail
rpm -qf /usr/sbin/sendmail
Nop, the email did not go through. So it is probably not the nagios configs which are a problem. Can you suggest me anything Sir.
Do you have a DNS on your network. Did you install the rpms for sendmail and mail. Unininstall sendmail and mail and reinstall with defaults.
Yes there is a seperate DNS server running on my network. I am going to try and reinstall sendmail and mail again.