problem with parents and service dependencies

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
td3201
Posts: 15
Joined: Sun Jan 25, 2015 6:16 pm

problem with parents and service dependencies

Post 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!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: problem with parents and service dependencies

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
td3201
Posts: 15
Joined: Sun Jan 25, 2015 6:16 pm

Re: problem with parents and service dependencies

Post 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?
td3201
Posts: 15
Joined: Sun Jan 25, 2015 6:16 pm

Re: problem with parents and service dependencies

Post 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         .*
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: problem with parents and service dependencies

Post by scottwilkerson »

Did this solve your original query?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
td3201
Posts: 15
Joined: Sun Jan 25, 2015 6:16 pm

Re: problem with parents and service dependencies

Post by td3201 »

I'm still curious on the parents directive for services. It's not working as expected on 4.0.8.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: problem with parents and service dependencies

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
td3201
Posts: 15
Joined: Sun Jan 25, 2015 6:16 pm

Re: problem with parents and service dependencies

Post 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
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: problem with parents and service dependencies

Post by scottwilkerson »

I re-confirmed this is still a bug, I'll get a core dev to take a look ASAP.

Thanks
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
griffin.wakem

Re: problem with parents and service dependencies

Post by griffin.wakem »

This appears to still be happening in 4.1.0rc1. Any luck identifying the issue?
Locked