Hello There, Guest!  
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

A couple of email items

#1
I noticed two issues when testing email on version 1.3. Maybe it is me, but I found:

1) The logging of the email was not working because Nagios did not apparently have sufficient rights to the /var/log/sendemail file. I manually updated the rights and then log entries began to be made.

2) When trying to sending an alert email the log showed the following:

“Dec 08 15:56:36 nems p1.pl[4046]: ERROR => You must specify a 'from' field!  Try --help.”

I checked the /etc/nagios3/resource.cfg file and the entries looked OK. See attached image.  It is almost as if the USER fields are null as far as Nagios is concerned. I hard coded the email information on the Nagios Notify-Host-By-Email entry and alerts are now working.


Attached Files Thumbnail(s)
   
Rick
 Reply
#2
Hey kd4pyr,
Thanks for the notes!

I've looked at my development unit on NEMS 1.3 and the permissions are correct on the log file.

-rw-r--r-- 1 nagios root 52K Dec 12 08:54 /var/log/sendemail

What were you seeing?

It's possible if yours has different permissions that I may have accidentally left a log file behind in the build... but I'd need to re-flash to confirm this.

Since your screenshot has $USER5$ configured, the errors showing that "from" is missing must be an old error (ie., from before you added your email to NEMS SST/resource.cfg). Please try sending a notification again and see if you still see that error.

Add a divider if you'd like, to make it stand out more...
Code:
echo '---------' >> /var/log/sendemail

Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
 Reply
#3
Sorry for the delay in getting back to you. Busy time.

For the issue of the sendemail file rights, I think I know what happened.  I was not using the file on my old system (it did not exist).  So maybe it was deleted by the restore?  I know it did not exist until I ran the email test code with SUDO. So maybe the file was created with the incorrect rights.
I am now using the default send email string in NConf:

/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/sendemail -s $USER7$ -xu $USER9$ -xp $USER10$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"

And the same email error is being logged.

Dec 14 17:22:42 nems sendemail[3093]: ERROR => You must specify a 'from' field!  Try --help.

I know the $USER$ variables are set.
 
Thanks.
Rick
 Reply
#4
Please run this command:


Code:
date && echo "---" && sudo cat /etc/nagios3/resource.cfg | grep USER5 && echo "---" && sudo tail /var/log/sendemail



Please post the output of this command.
Robbie Ferguson // The Bald Nerd

Did I help you out? Appreciate what I do? Please consider saying thanks:
 Reply
#5
[[email protected]][email protected][/email]:~ $ date && echo "---" && sudo cat /etc/nagios3/resource.cfg | grep USER5 && echo "---" && sudo tail /var/log/sendemail
Sun 17 Dec 17:31:13 EST 2017
---
[sudo] password for kd4pyr:
[email=$USER5$[email protected]]$USER5$[email protected][/email]
---
Dec 14 17:22:42 nems sendemail[3093]: ERROR => You must specify a 'from' field!  Try --help.
Dec 14 17:22:52 nems sendemail[3135]: ERROR => You must specify a 'from' field!  Try --help.
Dec 16 06:16:22 nems sendemail[23371]: ERROR => You must specify a 'from' field!  Try --help.
Dec 16 06:26:22 nems sendemail[28359]: ERROR => You must specify a 'from' field!  Try --help.
[[email protected]][email protected][/email]:~ $
Rick
 Reply
 
 
Forum Jump:

Users browsing this thread: 1 Guest(s)