Hello everyone, I’m fairly new to Nagios and I’ve managed to configure everything as I want it to be but Nagios isn’t creating alert emails or sending me over to my email address.
I’m running it on Suse Linux 10.1. This machine is purely configured for Nagios and by the looks of it Suse Linux is using Postfix instead of Sendmail and when I do
/etc/rc.d/postfix status
It tells me that postfix is running
I haven’t changed anything in commands.cfg file and here’s a copy - paste of what its in.
‘host-notify-by-email’ command definition
define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios 2.7 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /usr/bin/mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}
‘notify-by-email’ command definition
define command{
command_name notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios 2.7 ***\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}
This is what I’ve got configured in my minimal.cfg file.
define contact{
contact_name nagios
alias Nagios
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email my email address where I want the nagios alerts to go to
}
When I send a test email to my workstation from command line using either mail or nail command, I receive the email within seconds. I really don’t have a clue where the problem lies so please help.