Not Sending Notification Emails
Posted: Mon Jan 18, 2016 10:43 am
I have all my services and hosts set up and Nagios is monitoring them correctly.
However I am not getting email alerts when a service or host has an alert.
I do get an email if I select Send Custom service notification in Nagios Core.
How do I get Nagios to email me when a service has a change of state.
Contacts.cfg
define contact {
contact_name nagiosadmin
alias Nagios Admin
contactgroups admins
host_notifications_enabled 1
service_notifications_enabled 1
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,process-host-perfdata
service_notification_commands notify-service-by-email,process-service-perfdata
email mywork@emailaccount
use generic-contact
register 1
}
Command.cfg
define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
register 1
}
Can someone help in resolving the issue please?
However I am not getting email alerts when a service or host has an alert.
I do get an email if I select Send Custom service notification in Nagios Core.
How do I get Nagios to email me when a service has a change of state.
Contacts.cfg
define contact {
contact_name nagiosadmin
alias Nagios Admin
contactgroups admins
host_notifications_enabled 1
service_notifications_enabled 1
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,process-host-perfdata
service_notification_commands notify-service-by-email,process-service-perfdata
email mywork@emailaccount
use generic-contact
register 1
}
Command.cfg
define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
register 1
}
Can someone help in resolving the issue please?