Page 1 of 2

problem with parents and service dependencies

Posted: Sun Feb 15, 2015 12:33 pm
by td3201
I was trying to get the parents directive to work for services but figured out that this bug still exists since April of 2014?
http://tracker.nagios.org/view.php?id=562

Since that appears to be the case, I am trying a service dependency instead. I simply want to ensure that any services that depend on the nsclient++ service to be running don't check or notify if nsclient++ is down:

Code: Select all

define servicedependency{
        host_name                       .*
        service_description             service-nscp
        dependent_host_name             .*
        dependent_service_description   services-all-auto
        }

With this in place, it shows no service dependencies in the UI or when I do a check. However, if I screw up the config, the check fails:
Checking for circular paths...
Checked 19 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods

And when I screw up the config:
Reading configuration data...
Read main config file okay...
Error: Invalid servicedependency object directive 'shit'.
Error: Could not add object property in file '/etc/nagios/objects/servicedependencies.cfg' on line 2.
Error processing object config files!

Any ideas? Thanks!

Re: problem with parents and service dependencies

Posted: Sun Feb 15, 2015 5:07 pm
by Box293
What version of Nagios Core are you using?
td3201 wrote:I am trying a service dependency instead. I simply want to ensure that any services that depend on the nsclient++ service to be running don't check or notify if nsclient++ is down:

Code: Select all

    define servicedependency{
            host_name                       .*
            service_description             service-nscp
            dependent_host_name             .*
            dependent_service_description   services-all-auto
            }
This is not a valid service dependency. You cannot use .* and you have not defined any criteria or periods.

Here is an example of a valid service dependency:

Code: Select all

define servicedependency{
        host_name                       winserver1
        service_description             NSClient++ Version
        dependent_host_name             winserver1
        dependent_service_description   Uptime,CPU Load,Memory Usage,C:\ Drive Space,W3SVC,Explorer
        execution_failure_criteria	   w,u,c,p,
        notification_failure_criteria   w,u,c,p,
        dependency_period               24x7
        }
With this dependency in place, when the service "NSClient++ Version" goes into a HARD w,u,c,p state, the dependent services will not have their checked executed. The next scheduled check time will be pushed back another x as per what is defined in their check_interval. Their service state will remain as is as the checks are not being executed so nothing changes. IF a dependent service was already in a HARD state and was not acknowledged, further notifications will be disabled until the service "NSClient++ Version" goes back into a HARD OK state.

Here is some reading material on service dependencies:
http://nagios.sourceforge.net/docs/3_0/ ... dependency
http://nagios.sourceforge.net/docs/3_0/ ... ncies.html

Re: problem with parents and service dependencies

Posted: Sun Feb 15, 2015 9:07 pm
by td3201
Box293 wrote:What version of Nagios Core are you using?
Sorry, should have put this in my original post. 4.0.8

As far as getting service dependencies to work, I think I know how to do it. To get around explicitly putting every host in there, I can create a hostgroup and glob in all the hosts, then put this hostgroup directive in the service dependency. I think I've done that before. Will try that for fun.

Service Dependencies is really not what I need here. Just need the parents directive to work. Is that still an outstanding bug?

Re: problem with parents and service dependencies

Posted: Mon Feb 16, 2015 11:40 am
by td3201
Here's the working config:

Code: Select all

define servicedependency{
        hostgroup_name                  z-allhosts
        service_description             service-nscp
        dependent_service_description   services-all-auto
        execution_failure_criteria      n
        notification_failure_criteria   w,u,c
        }
define hostgroup {
        hostgroup_name  z-allhosts
        members         .*
}

Re: problem with parents and service dependencies

Posted: Tue Feb 17, 2015 11:36 am
by scottwilkerson
Did this solve your original query?

Re: problem with parents and service dependencies

Posted: Tue Feb 17, 2015 2:39 pm
by td3201
I'm still curious on the parents directive for services. It's not working as expected on 4.0.8.

Re: problem with parents and service dependencies

Posted: Wed Feb 18, 2015 1:47 pm
by scottwilkerson
I believe that bug may be suspect, and I posted on the tracker for some more information.

Can you share what you are experiencing with service parents?

Also, please post applicable config files and template files.

Thanks.

Re: problem with parents and service dependencies

Posted: Wed Feb 18, 2015 3:49 pm
by td3201
When the parent service goes down, nagios continues to check and notify about child services:

define service{
use generic-service,24x7,infrastructure,check3
hostgroups windows
service_description service-nscp
check_command check-nrpe-win-service!$HOSTADDRESS$!nscp
servicegroups nscp
}
define service{
use generic-service-notifications-disabled,perf-service,24x7,infrastructure
hostgroups windows
service_description memory pages per sec
parents service-nscp
check_command check-nrpe-win-memory-pages!$HOSTADDRESS$
}
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
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
notification_options w,u,c,r
notification_interval 15
register 0
}

Re: problem with parents and service dependencies

Posted: Thu Feb 19, 2015 5:29 pm
by scottwilkerson
I re-confirmed this is still a bug, I'll get a core dev to take a look ASAP.

Thanks

Re: problem with parents and service dependencies

Posted: Wed Apr 29, 2015 12:38 pm
by griffin.wakem
This appears to still be happening in 4.1.0rc1. Any luck identifying the issue?