Mail notifications configuration (starting with Nagios)

Hej,

I have started using Nagios and I have some problems for configuring the mail notifications.

First I configured Postfix and I checked it works receiving successfully the following mail:

/usr/bin/printf “text” | /bin/mail -s “subject” [email protected]

After I installed and configured Nagios following the Nagios Quickstart Installation Guides adding my mail as the email of nagiosadmin contact (default).

When I login in Nagios web interface I check an expected service problem (critical) which supposedly runs 'notify-service-by-email 'command but I never receive the email.

I’m sure there should be a standard answer for this newbie question… any idea? :smiley:

check the notifications page. did nagios generate the notifcation?
if yes cehck the postfix logs. /var/log/mail.info and see whta happened to your email :slight_smile:

I have checked the notifications page (and several forums) and supposely it should work.

Btw, I changed ‘notify-service-by-email’ in commands.cfg like this;

‘notify-service-by-email’ command definition

define command{
command_name notify-service-by-email
command_line /usr/bin/printf blablabla >> /root/a.txt
}

And I create a new service which create a critical state (it does in the web interface) but the file a.txt does not appear…

I guess the problem came from the notifying configuration…

That can’t work, user nagios is trying to write in the root owned directory… try using /tmp…

[quote=“luca”]

That can’t work (at least it shouldn’t work), user nagios is trying to write in the root owned directory… try using /tmp…[/quote]

[size=200]SOLVED![/size]

With /tmp it works perfectly and checking the mail logs:

sendmail[17613]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/clientmqueue/): Permission denied

I modified the permissions of that folder and… THANKS :wink:

(Using /root was totally confusing me)