Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I can't figure out but for some reason Nagios doesn't send me an alert on some of the services that I monitor, I was wondering if someone can help me out a bit.

this is service

define service {
    hostgroup_name			nrpe-disk
    service_description		disk
    use				alarm,check
    check_command			check_nrpe1!check_disk
    register			1
    }

here is my command

define command {
       command_name                     	check_nrpe1
       command_line                     	$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

here is service template

define service {
       name                             	alarm
       notification_interval            	0
       notification_period              	247
       notification_options             	w,u,r,c,f,s
       notifications_enabled            	1
       contact_groups                   	staff
       register                     	0

}
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/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}   

define command {
       command_name                     	notify-host-by-pager
       command_line                     	/usr/bin/printf "%b" "Notification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$" | /usr/bin/mail $CONTACTPAGER$
}   

define command {
       command_name                     	notify-service-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: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}   

define command {
       command_name                     	notify-service-by-pager
       command_line                     	/usr/bin/printf "%b" "Notification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail $CONTACTPAGER$
}   
define contactgroup {
    contactgroup_name             		staff
    alias                         		XXXXXXXX
    members                       		XXXXXXXX XXXXXXXX
    }	
define contact {
    contact_name                  		XXXXXXX XXXXXX
    alias                         		XXXXXXXXX
    host_notifications_enabled    		1
    service_notifications_enabled 		1
    host_notification_period      		247
    service_notification_period   		247
    host_notification_options     		d,u,r,f,s
    service_notification_options  		w,u,c,r,f,s
    host_notification_commands    		notify-host-by-email,notify-host-by-pager
    service_notification_commands 		notify-service-by-email,notify-service-by-pager
    email                         		XXXXXXXXX@XXXXXXXX.XXX
    pager                         		XXXXXXXXXX@messaging.sprintpcs.com
    }
share|improve this question
    
Does everything seem right in the web interface? –  Morven Sep 20 '09 at 0:56
    
yes, it seems fine on web, other where it says 0 notifications has been sent –  alexus Sep 21 '09 at 14:54
add comment

5 Answers

up vote 1 down vote accepted
+50

I don't see it mentioned in your question or any of the answers but have you checked the nagios.cfg file for the *enable_notifications* setting? Is it set to 0 or 1?

Also is this only happening on a given service notification or is it affecting all notifications? If it's all I would suspect that enable_notifications is set to 0 in the nagios.cfg file. If so try changing it to 1 and restarting Nagios.

share|improve this answer
    
of course, if this wouldn't be enabled i wouldn't get any notifications, that's why i said it doesn't send an alert on some of the services, not all, just some ! –  alexus Oct 9 '09 at 14:13
add comment

My first step would be to try defining all the parameters directly rather than depending on inheritance. Avoid groups, too, if you can. This at least gives you a clean starting place to debug from.

define service {
    host_name                  XXXXXXX
    service_description        disk
    notification_interval      0
    notification_period        247
    notifications_enabled      1
    contacts                   XXXXXXX
    check_command              check_nrpe1!check_disk
    }

You might also want to try switching notification_interval to something else, even leave it out (defaults to 60). Just until you get it working.

share|improve this answer
    
then change one thing at a time, checking that it's working every time. –  Zac Thompson Oct 8 '09 at 18:59
add comment

Do you have a "notify-by-email" section in your commands config file? Here's the relevant section from mine:

'notify-by-email' command definition

define command{ command_name send-email command_line /usr/bin/printf "%b" " Nagios \n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ }

Can your system send mail in general? Can you use "mail -s test foo@bar.com", then type some text, a blank line and finally Ctrl-D to send?

share|improve this answer
    
yes, i'm able to send out an emails, also some of services are working fine in terms of notifications and some not... –  alexus Sep 21 '09 at 1:42
    
I would then suspect your group configuration is not correct. You are in the notification group for some services and not for others. Another answer could be that you don't have notification types set up correctly for some services or groups. –  Keith Stokes Sep 21 '09 at 11:27
    
i added to main question contactgroups and contacts –  alexus Sep 21 '09 at 14:54
    
Is 247 a valid time period? Does running /path/to/nagios/executable -v /path/to/nagios/config/file/nagios.cfg give you any errors? –  Keith Stokes Sep 22 '09 at 11:02
    
247 is a valid time period. no errors when running pre-flight check –  alexus Sep 23 '09 at 21:10
add comment

changing

register 0

to

register 1

in your "alarm" service might help.

share|improve this answer
    
you probably missed it, but that was service template, all templates must have register 0 –  alexus Oct 5 '09 at 15:29
add comment

Where's the service-template for check ? Since you're using with templates alarm and check. I guess check overwrites alarm...

define service {
    hostgroup_name  		nrpe-disk
    service_description 	disk
    use 			alarm,check
    check_command   		check_nrpe1!check_disk
    register    		1
    }

perhaps *notification_failure_criteria* can help you

Do you really have a *notification_period* called 247 or rather 24x7?

You get a correct feedback from your command (so there should be a alarm?)? you tested the command on the command-line (as your nagios-user)?

share|improve this answer
    
notification_failure_criteria that's service dependencies, I didn't get to that part yet. as far as one template goes over the other one, unlikely as some of services are working and some are not, they both using same templates (alarm and check), my time period is 247, not 24x7 if my time period would be incorrect nagios would complain while starting, it doesn't, yes I did test everything manually as nagios user and it works –  alexus Oct 8 '09 at 2:41
    
What about your host-template? Or your host-group(templates)? Since you didn't post them we can't loo through them. Please post or check those. (-1? My Answer makes sense, so why "-1"?) –  ppuschmann Oct 8 '09 at 8:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.