Nagios Notifications dont work
Posted: Wed Feb 20, 2019 4:13 pm
Evening,
I'm trying to get nagios notifications to work, but it seems something is still going wrong.
First my contacts.cfg:
define contact {
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
In the command.conf i changed the 2 notify rules to:
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: $LONG$
}
and 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/T$
}
Freshly installed Postfix for this.
When i test this by sending an custom service notification, it all goes well and the output of nagios.log shows:
[1550697140] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;Host;PING;0;Nagios Admin;q
[1550697140] SERVICE NOTIFICATION: nagiosadmin;Host;PING;CUSTOM (CRITICAL);notify-service-by-email;PING CRITICAL - Packet loss = 100%;Nagios Admin;q
But I'm not getting an email in my inbox.
Is there anything that I'm missing?
Thanks in advance.
Kind regards,
I'm trying to get nagios notifications to work, but it seems something is still going wrong.
First my contacts.cfg:
define contact {
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
In the command.conf i changed the 2 notify rules to:
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: $LONG$
}
and 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/T$
}
Freshly installed Postfix for this.
When i test this by sending an custom service notification, it all goes well and the output of nagios.log shows:
[1550697140] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;Host;PING;0;Nagios Admin;q
[1550697140] SERVICE NOTIFICATION: nagiosadmin;Host;PING;CUSTOM (CRITICAL);notify-service-by-email;PING CRITICAL - Packet loss = 100%;Nagios Admin;q
But I'm not getting an email in my inbox.
Is there anything that I'm missing?
Thanks in advance.
Kind regards,