Email Notifications
kellyjackie at eircom.net
kellyjackie at eircom.net
Mon Nov 17 10:27:58 CET 2008
Thanks to everyone for their response on email notifications, i now have the commands.cfg file configured to work correctly with esmtp(when tested from the command line). The syntax is as follows:
# 'notify-host-by-email' command definition
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" | /usr/bin/esmtp -C /etc/esmtprc $CONTACTEMAIL$ -f nagios at dpd.ie -X /tmp/esmtp.log
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-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" | /usr/bin/esmtp -C /etc/esmtprc $CONTACTEMAIL$ -f nagios at dpd.ie -X /tmp/esmtp.log
}
However nagios still doesnt send email so there must be a mistake with the configuration files. The windows.cfg file :
define host{
use windows-server ; Inherit default values from a template
host_name invoicepc ; The name we're giving to this host
alias invoicingpc ; A longer name associated with the host
address 10.1.10.101 ; IP address of the host
notifications_enabled 1
notification_interval 120
notification_period 24x7
notification_options d,u,r
}
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
members invoicepc
}
define service{
use generic-service
hostgroup_name windows-pcs
service_description Uptime
check_command check_nt!UPTIME
contact_groups admins
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 1440
notification_period 24x7
}
The contacts.cfg file reads:
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email x at email.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list