Email notifications not working with multiple addresses - Nagios 4.3.2

1,112 views
Skip to first unread message

Cullen Philippson

unread,
Sep 20, 2017, 12:12:45 PM9/20/17
to nagrestconf-users
Hello Mark,

I made the mistake of upgrading my Nagios from 3.x to 4.x on my CentOS box and ran into this and a few other issues.  I'm mostly sorted out now, but this one remains.

CentOS 6.9
Nagios 4.2.3
NagRestConf 1.174.6

I think I've encountered an issue with how multiple email addresses are used in NagRestConf.  The addresses end up being separated by a ` 
This, in Nagios 4.3.2, causes an issue with Notifications, shown below.  If I use one address the service notification goes through like it should, when I add an additional address, barf.

[1505922635] SERVICE NOTIFICATION: AbaPageAdmins;ib2-server-2;List Count;WARNING;notify-service-by-email;List Count 4803
[1505922635] wproc: NOTIFY job 105337 from worker Core Worker 7039 is a non-check helper but exited with return code 1
[1505922635] wproc:   host=ib2-server-2; service=Ice List Count; contact=AbaPageAdmins
[1505922635] wproc:   early_timeout=0; exited_ok=1; wait_status=256; error_code=0;
[1505922635] wproc:   stderr line 01: /bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
[1505922635] wproc:   stderr line 02: /bin/sh: -c: line 1: syntax error: unexpected end of file


/etc/nagios/objects/local/local_contacts.cfg

...
define contact {
       contact_name                  AbaPageAdmins
       alias                         Aba Page Admins
       email                         page-...@mydomain.com` myad...@mydomain.com
       service_notification_period   24x7
       service_notification_options  w,u,c,r,f
       service_notification_commands notify-service-by-email
       host_notification_period      24x7
       host_notification_options     d,u,r,f
       host_notification_commands    notify-host-by-email
       can_submit_commands           0
       service_notifications_enabled 1
       host_notifications_enabled    1
}
....

Mark Clarkson

unread,
Sep 21, 2017, 5:02:46 AM9/21/17
to nagrestc...@googlegroups.com
On Wed, 2017-09-20 at 09:12 -0700, Cullen Philippson wrote:
define contact {
       contact_name                  AbaPageAdmins
       alias                         Aba Page Admins
       email                         page-...@mydomain.com` myad...@mydomain.com
       service_notification_period   24x7
       service_notification_options  w,u,c,r,f
       service_notification_commands notify-service-by-email
       host_notification_period      24x7
       host_notification_options     d,u,r,f
       host_notification_commands    notify-host-by-email
       can_submit_commands           0
       service_notifications_enabled 1
       host_notifications_enabled    1
}

Hi Cullen,
Nagios email field is not a list, it cannot contain more than one item. You should create individual contacts then add the contact_name to the members property of a contact group. The contact group will be used in service definitions rather than a contact. So contact definitions will look something like:

define contact {
       contact_name                  AbaPageAdmins
       alias                         AbaPageAdmins
       service_notification_period   24x7
       service_notification_options  w,u,c,r
       service_notification_commands notify-service-by-email
       host_notification_period      24x7
       host_notification_options     d,u,r
       host_notification_commands    notify-host-by-email
       can_submit_commands           1
       service_notifications_enabled 1
       host_notifications_enabled    1
}

define contact {
       contact_name                  myaddress
       alias                         MyAddress
       email                        myad...@mydomain.com
       service_notification_period   24x7
       service_notification_options  w,u,c,r
       service_notification_commands notify-service-by-email
       host_notification_period      24x7
       host_notification_options     d,u,r
       host_notification_commands    notify-host-by-email
       can_submit_commands           0
       service_notifications_enabled 1
       host_notifications_enabled    1
}

#
# Contact Groups
#

define contactgroup {
       contactgroup_name             admins
       alias                         Administrator Group
       members                       AbaPageAdmins,myaddress
}

HTH
Mark

Cullen Philippson

unread,
Sep 21, 2017, 11:07:54 AM9/21/17
to nagrestconf-users
Many thanks. I missed that and had not seen this issue until now. 

Thank you kind sir,

Cullen

Mark Clarkson

unread,
Sep 22, 2017, 3:26:57 AM9/22/17
to nagrestc...@googlegroups.com
You are very welcome :)
Reply all
Reply to author
Forward
0 new messages