Trouble while configuring nagios notification

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
elsonr
Posts: 2
Joined: Sat Mar 07, 2015 3:30 pm

Trouble while configuring nagios notification

Post by elsonr »

I am trying to configure Nagios notification but I don't know what wrong I am doing. Tried looking at numerous online documentations but still stuck at the same place.
I am unable to understand why the mails are sent to [email protected] instead of the configured contact email ids.
Would appreciate if someone can quickly point out the mistake and suggest corrective action.

My nagios v4.0.2 is running on Redhat Linux Server.

Command used:
notify-host-by-email: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "$HOSTSTATE$ - $HOSTNAME$" -r "Nagios Alert <[email protected]>" $CONTACTEMAIL$

Error found in maillog:
Mar 8 02:02:26 msrv postfix/qmgr[29375]: 64DED300729: from=<[email protected]>, size=631, nrcpt=1 (queue active)
Mar 8 02:02:26 msrv postfix/smtp[33418]: 64DED300729: to=<[email protected]>, orig_to=<$>, relay=mail.abc.in[192.168.101.222]:25, delay=0.41, delays=0.28/0.01/0.03/0.08, dsn=5.1.1, status=bounced (host mail.abc.in[192.168.101.222] said: 550 5.1.1 Recipient unknown (in reply to RCPT TO command))

Please help.

Thanks,
Elson
elsonr
Posts: 2
Joined: Sat Mar 07, 2015 3:30 pm

Re: Trouble while configuring nagios notification

Post by elsonr »

Hi,

I have found my silly mistake in my contacts.cfg file and I would like to share the same to my friends out here who are also also stuck at this point.

My old contacts.cfg
define contact {
contact_name nagiosadmin
alias Nagios Admin
contactgroups admins
host_notifications_enabled 0
service_notifications_enabled 0
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s,n
service_notification_options w,u,c,r,f,s,n
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
email [email protected]
use generic-contact
register 1
}

My corrected contacts.cfg
define contact {
contact_name nagiosadmin
alias Nagios Admin
contactgroups admins
host_notifications_enabled 0
service_notifications_enabled 0
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
email [email protected]
use generic-contact
register 1
}

Hope this helps all friends here having same issue.

Thanks,
Elson
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Trouble while configuring nagios notification

Post by Box293 »

Can you post your the host or service definition and the contact definition used.

I've seen similar issues to this before where the notify-host-by-email OR the notify-service-by-email command is being assigned to the host object or service object as an event handler instead of being defined in the contact notification commands.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked