Hello all
Hopefully one of you Nagios experts can give me a hand with this!
I have deployed Nagios a few times now and in an older Nagios 2.x deployment I had Dependencies working perfectly but I had defined every service individually for every host.
In my latest deployment of Nagios I have taken advantage of the new features in using Templates to control Services for multiple hosts etc but it seems I have run into trouble when it comes to defining dependencies for the services.
I’ll try to describe whats happening, during the pre-flight check I get the following error:
Error: Could not find a service matching host name ‘testlab’ and description ‘service1’ (config file ‘/dependencies.cfg’, starting on line 4)
Error: Could not expand dependent services specified in service dependency (config file ‘/dependencies.cfg’, starting on line 4)
Error processing object config files!
define servicedependency{
host_name testlab
service_description PING
dependent_host_name testlab
dependent_service_description service1
notification_failure_criteria c,u
execution_failure_criteria n
}
So it will check the host for the ‘service1’ service. The problem with this is that it is defined as follows:
define service{
use service1
host_name testlab
}
Which is using this as a template:
define service{
name service1 ; The ‘name’ of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness’
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
check_period 24x7 ; The service can be checked at any time of the day
max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state
normal_check_interval 10 ; Check the service every 10 minutes under normal conditions
retry_check_interval 2 ; Re-check the service every two minutes until a hard state can be determined
contact_groups admins ; Notifications get sent out to everyone in the ‘admins’ group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 60 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
I thought this may have just been a bug in the version of Nagios I was running but it seems to still happen in the 3.1.0 version. Kinda hoped it would just go away with an upgrade but no luck =)
Found the following article osdir.com/ml/network.nagios.deve … 00002.html
However they identify the problem as “problem with parsing service dependency templates
that specify “hostgroups” without “dependent_hostgroups” or vice versa.” which i’m not sure is what I’m seeing. They also have a ‘Register 0’ in the servicedependency definition which just causes mine to ignore the servicedependency altogether - which tbh is what I’d expect.
So yes, has anyone ran into this problem when using Service Templates and Dependencies? Any advice or ideas would be appreciated.
Cheers