Introduction
Beginning with release 0.0.7, NetSaint supports optional service dependencies. Service dependencies are an advanced feature that allow you to control the behavior of services based on the status of one or more other services. More specifically, you can repress the execution of service checks and notifications for services if various criteria that you specify are met.
Overview
The image below shows an example layout of service dependencies. There are a few things you should notice:
Defining Service Dependencies
First, the basics. You create service dependencies by adding servicedependency[] definitions in your host config file(s). In each definition you specify the dependent service, the service you are depending on, and the criteria (if any) that cause the execution and notification dependencies to fail (these are described later).
You can create several dependencies for a given service, but you must add a separate servicedependency[] definition for each dependency you create.
In the example above, the dependency definitions for Service F would be defined as follows:
servicedependency[Service F;Host C]=Service D;Host B;o;
servicedependency[Service F;Host C]=Service E;Host B;;wuc
servicedependency[Service F;Host C]=Service C;Host B;w;c
How Service Dependencies Are Tested
Before NetSaint executes a service check or sends notifications out for a service, it will check to see if the service has any dependencies. If it doesn't have any dependencies, the check is executed or the notification is sent out as it normally would be. If the service does have one or more dependencies, NetSaint will check each dependency entry as follows:
This cycle continues until either all dependencies for the service have been checked or until one dependency check fails.
*One important thing to note is that by default, NetSaint will use the most current hard state of the service(s) that is/are being depended upon when it does the dependeny checks. If you want Netsaint to use the most current state of the services (regardless of whether its a soft or hard state), enable the soft_service_dependencies option.
Execution Dependencies
If all of the execution dependency tests for the service passed, NetSaint will execute the check of the service as it normally would. If even just one of the execution dependencies for a service fails, NetSaint will temporarily prevent the execution of checks for that (dependent) service. At some point in the future the execution dependency tests for the service may all pass. If this happens, NetSaint will start checking the service again as it normally would. More information on the check scheduling logic can be found here.
In the example above, Service E would have failed execution dependencies if Service B is in a WARNING or UNKNOWN state. If this was the case, the service check would not be performed and the check would be scheduled for (potential) execution at a later time.
Notification Dependencies
If all of the notification dependency tests for the service passed, NetSaint will send notifications out for the service as it normally would. If even just one of the notification dependencies for a service fails, NetSaint will temporarily repress notifications for that (dependent) service. At some point in the future the notification dependency tests for the service may all pass. If this happens, NetSaint will start sending out notifications again as it normally would for the service. More information on the notification logic can be found here.
In the example above, Service F would have failed notification dependencies if Service C is in a CRITICAL state, and/or Service D is in a WARNING or UNKNOWN state, and/or if Service E is in a WARNING, UNKNOWN, or CRITICAL state. If this were the case, notifications for the service would not be sent out.
Dependency Inheritance
As mentioned before, service dependencies are not inherited. In the example above you can see that Service F is dependent on Service E. However, it does not automatically inherit Service E's dependencies on Service B and Service C. In order to make Service F dependent on Service C we had to add another service dependency definition. There is no dependency definition for Service B, so Service F is not dependent on Service B. In some cases the lack of inheritance means you're going to have to add some additional dependency definitions in your config file, but I think it makes things much more flexible. For instance, in the example above we might have good reason for not making Service F dependent on Service B. If dependencies were automatically inherited, this would not be possible.