Notification is enabled in nagios.cfg
[root@nagios ~]# cat /usr/local/nagios/etc/nagios.cfg | grep enable_notifications
enable_notifications=1
below is content of my host's cfg
commands' cfgs:define host {
host_name maplebee-001
address 10.10.10.10
check_command check-host-alive!!!!!!!!
max_check_attempts 2
check_interval 2
retry_interval 1
check_period 24x7
flap_detection_enabled 0
contacts maplebee
notification_interval 5
notification_period 24x7
notification_options d,u,r,f,s,
notifications_enabled 1
register 1
}
below is content of my contact's cfg
define contact {
contact_name maplebee
alias maplebee
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
service_notification_commands notify-service-by-email
email maplebeexyz001@gmail.com
}
define command {
command_name notify-host-by-email
command_line /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 "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
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$
}
I am able to run the mail test command from cli as root and also nagios user.
/usr/bin/printf "%b" "test" | /bin/mail -s "test subject" maplebeexyz001@gmail.com
My tail -f on nagios.log shows Host Notification HARD, but there is no HOST email alerting out msg
what am I doing wrong here? I've spent almost a couple days trying to figure this out