Page 1 of 1

Service Dependencies for Hierarchical topology

Posted: Tue Mar 12, 2019 7:34 am
by parisa
Hi
I have more than 1000 hosts, each of these hosts have around 25 services.(1000*25 services) and I use passive check.
The hosts connects to each other in form of a tree and i have a service for each host that the service depends on the same service of its parent.

For more explanation:
host_A is parent of host_B and host_B is parent of host_C and host_C is parent of host_D and ... . All of the hosts have service_1
I want to configure service dependencies for them as below.

define servicedependency{
host_name host_A
service_description service_1
dependent_host_name host_B
dependent_service service_1
inherits_parent 1
}

define servicedependency{
host_name host_B
service_description service_1
dependent_host_name host_C
dependent_service service_1
notification_failure_criteria w,u,c
inherits_parent 1
}

define servicedependency{
host_name host_C
service_description service_1
dependent_host_name host_D
dependent_service service_1
inherits_parent 1
}


Because of topology of my hosts is Hierarchical (in form of tree) and a branch of the topology can be more than 6 levels, are there a way that I don't have to define the dependency for all of hosts for the service one by one?

Thanks

Re: Service Dependencies for Hierarchical topology

Posted: Tue Mar 12, 2019 12:43 pm
by lmiltchev
I don't see how this can be done in the GUI. You could probably come up with some kind of scripting solution in order to add the dependencies from the CLI. Then, you could place the servicedependencies.cfg in the /usr/local/nagios/etc/import directory, and run:

Code: Select all

/usr/local/nagiosxi/scripts/reconfigure_nagios.sh
If you wished to manage these dependencies manually, you could place them in the static directory. Read more about the manual config file management here:

https://support.nagios.com/kb/article/n ... t-160.html

Re: Service Dependencies for Hierarchical topology

Posted: Sat Mar 16, 2019 1:52 am
by parisa
Thanks for your answer
I have another question,If I define service dependencies for services of each host, for examples:
all hosts have some services (service_1, service_2,..., service_7) and are defined dependencies as below:

Code: Select all

define servicedependency{
host_name    host_A
service_description    service_1
dependent_host_name    host_A
dependent_service   service_2,service_3,service_4,service_5,service_6,service_7
inherits_parent	    1
}

define servicedependency{
host_name    host_A
service_description    service_2
dependent_host_name    host_A
dependent_service   service_3,service_4,service_5,service_6,service_7
inherits_parent	    1
}
should I define the service dependency for any host one by one or use scripting solution? are there another solution for it?

I have used scripting to define some dependencies, I need to define other dependencies, so I wanted to make sure that there are another way or not.

Re: Service Dependencies for Hierarchical topology

Posted: Mon Mar 18, 2019 4:37 pm
by npolovenko
@parisa, Scripting or manually creating these dependencies is the only way I can think of. Are you creating dependencies to prevent excessive notifications? Did you know that if a host goes into a critical state, none of its services will send any notifications? This is automatic.

Re: Service Dependencies for Hierarchical topology

Posted: Mon Mar 18, 2019 11:32 pm
by parisa
Thanks for your attention

I use SNMP Trap to monitor my services and have event handler for the services, I will create dependencies to prevent excessive notifications and also event handler is not executed .

Re: Service Dependencies for Hierarchical topology

Posted: Tue Mar 19, 2019 4:40 pm
by ssax
That makes sense, you would need to script out the dependency generation then in order to get them setup.