Thanks for the response.
For esmtp there is no sytax to use a subject line so i has to leave out -s and the following lines.
I checked the syntax at the command line and it works! thanks so much. The file now reads:
# '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@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@dpd.ie -X /tmp/esmtp.log
}
However i still dont recieve emails! The mistake must lie in the config files. Ive been over and over these files maybe you could have a quick look it might be a simple mistake. everything compiles correctly and the web interface is working perfectly.
The windows.cfg contains the following, all of the host , hostgroup and service definitions are basically the same. Should i also add lines to the host definition like notifications_enabled 1 etc.Is it enough fro it to be in the services definition and the contacts.cfg file
define host{
use windows-pcs ; 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 x.x.x.x ; IP address of the host
}
define hostgroup{
hostgroup_name windows-pcs ; The name of the hostgroup
alias Windows PCs ; 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@email.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}