[Nagios-users] Service Notifications not sending email
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{ namegeneric-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_information1 notification_period 24x7 register0 } define service{ namegeneric-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_information1 is_volatile 0 register0 } Time Period Declarations: define timeperiod{ timeperiod_name 24x7 alias 24 Hours A Day, 7 Days A Week sunday
Re: [Nagios-users] Service Notifications not sending email
-Original Message- From: [EMAIL PROTECTED] [mailto:nagios-users- [EMAIL PROTECTED] On Behalf Of Rob Groome Sent: Wednesday, June 27, 2007 5:10 PM To: Nagios-users@lists.sourceforge.net Subject: [Nagios-users] Service Notifications not sending email Lots of good stuff removed... 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%) This is good. Nagios tried to send a notification. That means the problem is with the notification command forward. notify-by-email command definition: # 'notify-by-email' command definition define command{ command_namenotify-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. In cases like this, it's often very useful to try to manually run the command that nagios is running to see if it errors out. Have you tried running the command above as the nagios user? It'll look something like the following if I've done my substitutions correctly, guessing at some -- /usr/bin/printf %b * Nagios *\n\nNotification Type: CRITICAL\n\nService: Disk - D:\nHost: system1\nAddress: 1.1.1.1\nState: DOWN\n\nDate/Time: Tue Jun 26 23:09:27 CDT 2007\n\nAdditional Info:\n\nd:\ - total: 213.20 Gb - used: 12.10 Gb (6%) - free 201.11 Gb (94%)\n /=2132MB;7844;7854;89;7874\n\n | /bin/mail -s ** CRITICAL alert - system1/Disk - D: is CRITICAL ** [EMAIL PROTECTED] I also prefer to use /bin/echo -e instead of /usr/bin/printf %b myself. It seems to have less problems with things like d:\ in plugin output. -- Marc - 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@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
Re: [Nagios-users] Service Notifications not sending email
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_namenotify-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$ } This is fixed now thanks to help from Marc Powell who led me in the right direction. If you look at the command_line for the above notification command you will notice that the $SERVICEACKCOMMENT does not have the trailing $ for the variable. Because of this - the email for the service notifications are not sent out - and there is also no error associated with that problem. I added in the $ at the end of the variable and now the service notifications are working again. Crazy easy, but so simple to miss. Thanks again Marc! 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@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