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

Nagios not sending notification for my services. I have two service called PING and STATUS in nagios localhost.

PING service check host availability using ping command and STATUS service get the SNMP traps from remote machine.

Sometimes i getting email for PING service but STATUS service not getting any mail. PING service also not sending mail always. Below all of my configuration files.

localhost.cfg

define host{
use               linux-server
host_name         TESTHOST
alias             snmp_agent
address           10.10.62.5
}
define service{
use                             local-service        
host_name                       TESTHOST
service_description             PING
check_command                   mailtest
notifications_enabled           1
}
define service{ 
host_name                 TESTHOST    
service_description       STATUS  
is_volatile               1
check_freshness           1       
check_command             cagent!5        
max_check_attempts        4
normal_check_interval     1
retry_check_interval      1
active_checks_enabled     0   
passive_checks_enabled    1   
check_period              24x7    
notification_interval     20      
notification_period       24x7    
notification_options      w,u,c   
notifications_enabled     1
flap_detection_enabled    0
}

contacts.cfg

define contact{
contact_name        nagiosadmin                 
use                 generic-contact             
alias               Nagios Admin                 
email               mymail@gmail.com                    
}
define contactgroup{
contactgroup_name   admins
alias               Nagios Administrators
members             nagiosadmin
}

I using ssmtp mail server to send mail. configuration file below

ssmtp.conf

root=mymail@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
hostname=sujin
UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN
AuthUser=mymail@gmail.com  
AuthPass=mailpassword
FromLineOverride=YES
share|improve this question
    
fwiw, normal_check_interval and retry_check_interval are deprecated/2.x syntax. –  Keith Apr 5 '13 at 20:53
    
@Keith - both options are still supported in the latest 3.5.0 core, and prob will be for some time. –  Jim Black Apr 7 '13 at 15:00
    
yes, that's what 'deprecated' means –  Keith Apr 10 '13 at 21:11

1 Answer 1

up vote 1 down vote accepted

You are getting emails for PING because you appear to have used your email notification command (mailtest) as the check_command:

define service{
    use                             local-service        
    host_name                       TESTHOST
    service_description             PING
    check_command                   mailtest       ; <<<
    notifications_enabled           1
}

The check_command for PING would conventionally be a check_ping command object. The command to send notifications is a property of a contact object.

You don't have active checks enabled for STATUS, so Nagios will never schedule a check for that service (it will rely on NRPE or NRDP or some other external process). That's probably not what you want.

You do not appear to have associated any contact_groups with either your service or your host objects. However, the configuration you have added is really only part of the total configuration, you have not shown the default object templates, so I cannot say what has been inherited.

You seem to be having trouble understanding the Nagios object model, it's a little closer to programming than it is to configuration. The diagram here should help you understand this problem (it's a little old, and for Nagios 2, but it's a good starting point).

The Nagios documentation is accurate but quite concise (or terse), it's not great for learning from scratch, try this tutorial: http://users.telenet.be/mydotcom/howto/nagios/index.html

Once you get a better understanding on the object concept you can peek into the objects.cache file and see all of your objects defined completely (this is equivalent to the configuration view in the web UI, but easier to understand if you are editing the configuration files directly).

share|improve this answer
    
This is good advice. It can be summed up by "read everything in The Basics section of the Nagios docs". –  Keith Apr 5 '13 at 20:52

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.