I'll start out by stating that I'm not sure this contact ever worked. I've recently started relying on it more heavily for some email-only alerts (anything critical goes straight to pagerduty) and I've noticed that email isn't coming through. I should also state that I use NagiosQL for a nice graphical interface for Nagios Core.
Other than this one contact, email is working normally on the server and I do receive alerts which are configured to go to other addresses.
I can manually email the address at the command line and the message is delivered.
If I tail the nagios.log, I can see the alert being triggered and it calls out the contact in question for the notification.
The maillog for Postfix does contain any record of the email being sent. Postfix queues are empty. Other emails are being sent as expected.[1518461479] SERVICE NOTIFICATION: CloudServices-QPS-Admin-Email-contact;QP-Prod-US-East-Azure-SQL-Azure;QP-Prod-App-SQL-Azure-Check_DTU_Utilization-qp_master;WARNING;notify-service-by-email;DTU Utilization on qp-prod-dbs/qp_master is 37%: DTU Warning
Each service in our environment is constructed by defining the Service Check and then applying nested service templates.
Top layer: Define the service to be tested (essentially, define the command to use)
Middle Layer: Contact Groupdefine service {
#NAGIOSQL_CONFIG_NAME QP-Prod-App-SQL-Azure-Check_DTU_Utilization-qp_master
hostgroup_name QP-Prod-App-SQL-Azure
service_description QP-Prod-App-SQL-Azure-Check_DTU_Utilization-qp_master
use CloudServices-QPS-Crit-Email
check_command Azure_Check_DB_DTU!<MyAzureSubscriptionID>!"QP-Prod"!qp-prod-dbs!qp_master!80!90
register 1
}
Bottom Layer: Frequency and notification optionsdefine service {
name CloudServices-QPS-Crit-Email
service_description CloudServices-QPS-Crit-Email
display_name CloudServices-QPS-Crit-Email
use PagerDuty_Monitoring_Profile-5-5-1
contact_groups CloudServices-QPS-Admin-Email-Group
register 0
}
The contact group contains the contactdefine service {
name PagerDuty_Monitoring_Profile-5-5-1
service_description PagerDuty_Monitoring_Profile-5min
display_name PagerDuty_Monitoring_Profile-5min
is_volatile 0
max_check_attempts 5
check_interval 5
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 1
check_period 24x7
obsess_over_service 1
check_freshness 1
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
parallelize_check 1
register 0
}
define contactgroup {
contactgroup_name CloudServices-QPS-Admin-Email-Group
alias CloudServices-QPS-Admin-Email-Group
members CloudServices-QPS-Admin-Email-contact
register 1
}
The contact appears to be setup correctly.
The command works perfectly fine with any other contactdefine contact {
contact_name CloudServices-QPS-Admin-Email-contact
alias CloudServices-QPS-Admin-Email-contact
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,r
service_notification_options w,c,r
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
can_submit_commands 0
retain_status_information 1
retain_nonstatus_information 1
email <myemailaddress>
register 1
}
Any ideas why this one contact seems to be non-funcational?define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios 4.3.1 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n\n$LONGSERVICEOUTPUT$\n$SERVICEPERFDATA$\n\n\nFollow-up Response:\n\n1) Briefly define Root cause\n2) Impact to IT services (as felt by our customer)\n3) Remedy to fix (Immediate/short term)\n4) Remedy to prevent a recurrence (future/long term)\n\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" "$CONTACTEMAIL$"
register 1
Thanks