Service Notifications not sending email
Rob Groome
groome at ict.usc.edu
Thu Jun 28 00:09:44 CEST 2007
OK. So I have the following problem. I receive Host notifications
without any problem - email is working fine on the nagios monitoring
server. I am not, however receiving service notifications and cannot
figure out what the deal is. Any help would be appreciated as I
turned over every stone I can think of. I get the SERVICE
NOTIFICATIONS logged to syslog - but no email sent out. The
notifications are set to on, the timeperiods are correct and the
contacts and contactgroups are setup properly.
I have changed every possible parameter - except of course the right
one - and still no go.
I am running Nagios 2.9 and my configs follow.
Below are all pertinent configs. I am sure it is completely simple
and I am missing something completely obvious.....
nagios.cfg:
log_file=/usr/local/nagios/var/nagios.log
cfg_file=/usr/local/nagios/etc/commands.cfg
cfg_file=/usr/local/nagios/etc/localhost.cfg
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/dependencies.cfg
cfg_file=/usr/local/nagios/etc/escalations.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/servicegroups.cfg
cfg_dir=/usr/local/nagios/etc/local-configs
cfg_dir=/usr/local/nagios/etc/security
object_cache_file=/usr/local/nagios/var/objects.cache
resource_file=/usr/local/nagios/etc/resource.cfg
status_file=/usr/local/nagios/var/status.dat
nagios_user=nagios
nagios_group=nagios
check_external_commands=1
command_check_interval=-1
command_file=/usr/local/nagios/var/rw/nagios.cmd
external_command_buffer_slots=4096
comment_file=/usr/local/nagios/var/comments.dat
downtime_file=/usr/local/nagios/var/downtime.dat
lock_file=/usr/local/nagios/var/nagios.lock
temp_file=/usr/local/nagios/var/nagios.tmp
event_broker_options=-1
log_rotation_method=d
log_archive_path=/usr/local/nagios/var/archives
use_syslog=1
log_notifications=1
log_service_retries=1
log_host_retries=1
log_event_handlers=1
log_initial_states=0
log_external_commands=1
log_passive_checks=1
service_inter_check_delay_method=s
max_service_check_spread=30
service_interleave_factor=s
host_inter_check_delay_method=s
max_host_check_spread=30
max_concurrent_checks=0
service_reaper_frequency=10
check_result_buffer_slots=4096
auto_reschedule_checks=0
auto_rescheduling_interval=30
auto_rescheduling_window=180
sleep_time=0.25
service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5
retain_state_information=1
state_retention_file=/usr/local/nagios/var/retention.dat
retention_update_interval=60
use_retained_program_state=1
use_retained_scheduling_info=0
interval_length=60
use_aggressive_host_checking=0
execute_service_checks=1
accept_passive_service_checks=1
execute_host_checks=1
accept_passive_host_checks=1
enable_notifications=1
enable_event_handlers=1
process_performance_data=0
obsess_over_services=0
check_for_orphaned_services=1
check_service_freshness=1
service_freshness_check_interval=60
check_host_freshness=0
host_freshness_check_interval=60
aggregate_status_updates=1
status_update_interval=15
enable_flap_detection=0
low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0
date_format=us
p1_file=/usr/local/nagios/bin/p1.pl
illegal_object_name_chars=`~!$%^&*|'"<>?,()=
illegal_macro_output_chars=`~$&|'"<>
use_regexp_matching=0
use_true_regexp_matching=0
admin_email=nagios
admin_pager=pagenagios
daemon_dumps_core=0
localhost.cfg: (only pertinent info)
Host and Service Templates:
define host{
name generic-host
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_period 24x7
register 0
}
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
register 0
}
Time Period Declarations:
define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
contacts.cfg:
# 'it' contact definition
define contact{
contact_name it
alias IT Department
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email it at xxx.com
}
# 'helpdesk' contact definition
define contact{
contact_name helpdesk
alias ICT Helpdesk
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email helpdesk at xxx.com
}
contactgroups.cfg:
# 'all' contact group definition
define contactgroup{
contactgroup_name all
alias ALL Notifications
members it, helpdesk
}
Host and Service Definition for system:
# 'system1' host definition
define host{
use generic-host ; Name of
host template to use
host_name system1
alias system1
address xxx.xxx.xxx.xxx
check_command check-host-alive
max_check_attempts 10
contact_groups it
notification_interval 120
notification_period 24x7
notification_options d,u,r
}
# Service definition
define service{
use generic-service ;
Name of service template to use
host_name system1
service_description Disk - D:
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups it
notification_interval 60
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
check_command check_nt_disk!d!1%!5% ; (I
know this is ridiculous - it's for testing)
}
When set to the above I get the following in /var/log/messages:
Jun 27 10:44:46 alpha nagios: SERVICE NOTIFICATION: it;system1;Disk -
D:;CRITICAL;notify-by-email;d:\ - total: 213.20 Gb - used: 12.10 Gb
(6%) - free 201.11 Gb (94%)
notify-by-email command definition:
# 'notify-by-email' command definition
define command{
command_name notify-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: $DATE$ $TIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n
$SERVICEPERFDATA$\n$SERVICEACKCOMMENT\n" | /bin/mail -s "**
$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE
$ **" $CONTACTEMAIL$
}
Nothing in the mail.log file about email being sent - or trying to be
sent out.
Any help is appreciated! I realize that this is probably a simple
fix as I said before - but it is alluding me at the moment.
Thanks!
Rob
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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