Nagios Not Sending Notification emails after 4.0.8 Upgrade
Posted: Fri Mar 20, 2015 10:12 am
Hi Please can you help,
I upgraded Nagios from 3.4.5 to 4.0.8 earlier in the week and we are having problems that not all email notifications are being sent.
Our configuration sends all notification emails to a DUMMY contact defined in a template, then we use escalations to send all Critical emails to a central helpdesk. Our escalation file is below, this worked fine under 3.4.5
The nagios.log shows notifications are being raised but nothing is actually sent out. I have stopped/restart sendmail and sent test emails from the command prompt ok.
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nSERVICE: $HOSTALIAS$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nDescription: $HOSTALIAS$\nAddres
s: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\nAcknowledged by: $HOSTACKAUTHORALIAS$\nHUB: $_HOSTHUB$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE
$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nSERVICE: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nSt
ate: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\nAcknowledged by: $SERVICEACKAUTHORALIAS$\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVI
CEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Contact template
define contact{
name central-hub-contact ; The name of this contact template
host_notifications_enabled 1 ; Contact will recieve host notifications
service_notifications_enabled 1 ; Contact will recieve service notifications
service_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states
host_notification_options d,u,r,f,s ; send notifications for all host states,
service_notification_commands service-email-pnp4n-int-en-central ; send service notifications via email
host_notification_commands host-email-pnp4n-int-en-central ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}
define contact{
contact_name steve
use central-hub-contact
alias Steve
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
host_notifications_enabled 1 ; Contact will recieve host notifications
service_notifications_enabled 1 ; Contact will recieve service notifications
email [email protected]
}
#### Central HUB notifications ####
define command{
command_name service-email-pnp4n-int-en-central
command_line /usr/local/nagios/libexec/pnp4n_send_service_mail.central.hub.pl \
-p "Nagios" \
-f multi -u
}
define command{
command_name host-email-pnp4n-int-en-central
command_line /usr/local/nagios/libexec/pnp4n_send_host_mail.central.hub.pl \
-p "Nagios" \
-f graph -u
}
Escalations
###############################################################
# The two definitions below override the default DUMMY contact.
# ALL CRITICAL SERVICE NOTIFICATIONS - UNIX/LINUX & STORAGE.
define serviceescalation{
hostgroup_name all-servers,!citrix-servers,!lic-servers-WIN,!xen-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *,!arc,!pro_listener,!arc_listener, \
!pro_database,!tns-site1, \
!site1-DB
last_notification 750
notification_interval 5
escalation_options c,r
escalation_period workhours
contact_groups helpdesk,UnixAdmins
}
# ALL CRITICAL SERVICE NOTIFICATIONS - WINDOWS & CITRIX
define serviceescalation{
hostgroup_name citrix-servers,lic-servers-WIN,windows-servers,\
xen-servers,vmware-servers
service_description *
last_notification 750
notification_interval 5
escalation_options c,r
escalation_period workhours
contact_groups helpdesk,WindowsAdmins
}
############################################################
# The following two definitions send the first ten WARNING msgs
# to third line, then stop
# WARNING NOTIFICATIONS - LINUX - SERVICE ESCALATIONS
define serviceescalation{
hostgroup_name all-servers,!citrix-servers,!lic-servers-WIN,!xen-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *,!Proc_Aff!var
first_notification 1
last_notification 10
notification_interval 10
escalation_options w
escalation_period workhours
contact_groups UnixAdmins
}
define serviceescalation{
hostgroup_name all-servers,!citrix-servers,!lic-servers-WIN,!xen-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *,!Proc_Aff,!var
first_notification 10
last_notification 11
notification_interval 0
escalation_options w
escalation_period workhours
contact_groups UnixAdmins
}
# WARNING NOTIFICATIONS - WINDOWS - SERVICE ESCALATIONS
define serviceescalation{
hostgroup_name citrix-servers,tvp-lic-servers-WIN,windows-servers,\
lic-servers, xen-servers,vmware-servers, xen-tdp-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
host_name node1.co.uk
service_description *,!Proc_Aff
first_notification 1
last_notification 10
notification_interval 10
escalation_options w
escalation_period workhours
contact_groups WindowsAdmins
}
define serviceescalation{
hostgroup_name citrix-servers,tvp-lic-servers-WIN,windows-servers,\
lic-servers, xen-servers,vmware-servers, xen-tdp-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
host_name node1.co.uk
service_description *,!Proc_Aff
first_notification 10
last_notification 11
notification_interval 0
escalation_options w
escalation_period workhours
contact_groups WindowsAdmins
}
###########################################################
# The three definitions below escalate CRITICAL SERVICE alterts every 5mins
# through first,second and third line and onto Lee.
# NOTIFICATION1 - SERVICE ESCALATIONS
define serviceescalation{
hostgroup_name all-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *
first_notification 2
last_notification 10
notification_interval 5
escalation_options c,r
escalation_period workhours
contact_groups helpdesk,secondline
}
Logfile snippet
[1426861007] SERVICE NOTIFICATION: user;server;Daemon;CRITICAL;service-email-pnp4n-int-en-easten;CRITICAL:Error getting status: Cannot connect to license server system.
[1426861007] SERVICE NOTIFICATION: user2;server;Daemon;CRITICAL;service-email-pnp4n-int-en-easten;CRITICAL:Error getting status: Cannot connect to license server system.
I upgraded Nagios from 3.4.5 to 4.0.8 earlier in the week and we are having problems that not all email notifications are being sent.
Our configuration sends all notification emails to a DUMMY contact defined in a template, then we use escalations to send all Critical emails to a central helpdesk. Our escalation file is below, this worked fine under 3.4.5
The nagios.log shows notifications are being raised but nothing is actually sent out. I have stopped/restart sendmail and sent test emails from the command prompt ok.
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nSERVICE: $HOSTALIAS$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nDescription: $HOSTALIAS$\nAddres
s: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\nAcknowledged by: $HOSTACKAUTHORALIAS$\nHUB: $_HOSTHUB$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE
$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nSERVICE: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nSt
ate: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\nAcknowledged by: $SERVICEACKAUTHORALIAS$\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVI
CEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Contact template
define contact{
name central-hub-contact ; The name of this contact template
host_notifications_enabled 1 ; Contact will recieve host notifications
service_notifications_enabled 1 ; Contact will recieve service notifications
service_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states
host_notification_options d,u,r,f,s ; send notifications for all host states,
service_notification_commands service-email-pnp4n-int-en-central ; send service notifications via email
host_notification_commands host-email-pnp4n-int-en-central ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}
define contact{
contact_name steve
use central-hub-contact
alias Steve
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
host_notifications_enabled 1 ; Contact will recieve host notifications
service_notifications_enabled 1 ; Contact will recieve service notifications
email [email protected]
}
#### Central HUB notifications ####
define command{
command_name service-email-pnp4n-int-en-central
command_line /usr/local/nagios/libexec/pnp4n_send_service_mail.central.hub.pl \
-p "Nagios" \
-f multi -u
}
define command{
command_name host-email-pnp4n-int-en-central
command_line /usr/local/nagios/libexec/pnp4n_send_host_mail.central.hub.pl \
-p "Nagios" \
-f graph -u
}
Escalations
###############################################################
# The two definitions below override the default DUMMY contact.
# ALL CRITICAL SERVICE NOTIFICATIONS - UNIX/LINUX & STORAGE.
define serviceescalation{
hostgroup_name all-servers,!citrix-servers,!lic-servers-WIN,!xen-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *,!arc,!pro_listener,!arc_listener, \
!pro_database,!tns-site1, \
!site1-DB
last_notification 750
notification_interval 5
escalation_options c,r
escalation_period workhours
contact_groups helpdesk,UnixAdmins
}
# ALL CRITICAL SERVICE NOTIFICATIONS - WINDOWS & CITRIX
define serviceescalation{
hostgroup_name citrix-servers,lic-servers-WIN,windows-servers,\
xen-servers,vmware-servers
service_description *
last_notification 750
notification_interval 5
escalation_options c,r
escalation_period workhours
contact_groups helpdesk,WindowsAdmins
}
############################################################
# The following two definitions send the first ten WARNING msgs
# to third line, then stop
# WARNING NOTIFICATIONS - LINUX - SERVICE ESCALATIONS
define serviceescalation{
hostgroup_name all-servers,!citrix-servers,!lic-servers-WIN,!xen-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *,!Proc_Aff!var
first_notification 1
last_notification 10
notification_interval 10
escalation_options w
escalation_period workhours
contact_groups UnixAdmins
}
define serviceescalation{
hostgroup_name all-servers,!citrix-servers,!lic-servers-WIN,!xen-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *,!Proc_Aff,!var
first_notification 10
last_notification 11
notification_interval 0
escalation_options w
escalation_period workhours
contact_groups UnixAdmins
}
# WARNING NOTIFICATIONS - WINDOWS - SERVICE ESCALATIONS
define serviceescalation{
hostgroup_name citrix-servers,tvp-lic-servers-WIN,windows-servers,\
lic-servers, xen-servers,vmware-servers, xen-tdp-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
host_name node1.co.uk
service_description *,!Proc_Aff
first_notification 1
last_notification 10
notification_interval 10
escalation_options w
escalation_period workhours
contact_groups WindowsAdmins
}
define serviceescalation{
hostgroup_name citrix-servers,tvp-lic-servers-WIN,windows-servers,\
lic-servers, xen-servers,vmware-servers, xen-tdp-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
host_name node1.co.uk
service_description *,!Proc_Aff
first_notification 10
last_notification 11
notification_interval 0
escalation_options w
escalation_period workhours
contact_groups WindowsAdmins
}
###########################################################
# The three definitions below escalate CRITICAL SERVICE alterts every 5mins
# through first,second and third line and onto Lee.
# NOTIFICATION1 - SERVICE ESCALATIONS
define serviceescalation{
hostgroup_name all-servers, \
!site1-all-servers, !site2-all-servers, \
!site3-all-servers, !site4-all-servers
service_description *
first_notification 2
last_notification 10
notification_interval 5
escalation_options c,r
escalation_period workhours
contact_groups helpdesk,secondline
}
Logfile snippet
[1426861007] SERVICE NOTIFICATION: user;server;Daemon;CRITICAL;service-email-pnp4n-int-en-easten;CRITICAL:Error getting status: Cannot connect to license server system.
[1426861007] SERVICE NOTIFICATION: user2;server;Daemon;CRITICAL;service-email-pnp4n-int-en-easten;CRITICAL:Error getting status: Cannot connect to license server system.