Service Dependency
Posted: Wed Oct 02, 2019 7:04 pm
Hi,
I'm trying to set up Service Dependencies. I lay out the use case, variables, then present my solutions. Please respond to the questions in red. Further, please let me know if my understanding is incorrect and let me know the best way to implement this, if it is contrary to one of the solutions given below.
I make use of your documentation:
https://assets.nagios.com/downloads/nag ... tions.html
https://assets.nagios.com/downloads/nag ... ricks.html
Motivation:
Case1: OCC wants to be alerted for Mem if Mem & Processor Queue Length are both critical.
Case2: OCC wants to be alerted for Mem_db if Mem_db, Processor Queue Length, & “sqlservr” process CPU are all critical.
Service A := Mem
Service B := Mem_db
Service C := Processor Queue Length (PQL)
Service D := “sqlservr” process CPU (PCPU)
Each of the associated Services has a constituent HostGroup named similarly (eg Service A: Mem::Mem-Hg)
Universe All Windows Hosts.
Elementwise Hostgroup C is equivalent to the universe -- All hosts get the PQL Service.
Elementwise Hostgroup B is equivalent to Hostgroup D -- All SQL hosts
Elementwise Hostgroup A is the complement to Hostgroup B/D --Non-SQL hosts; equivalently universe - All SQL hosts
Case1 Soln:
1.A Can I make use of the "All Hosts In Multiple Hostgroups"
define servicedependency{
hostgroup_name HOSTGROUP C
service_description Service C
dependent_hostgroup_name HOSTGROUP A
dependent_service_description SERVICE A
notification_failure_criteria o,w,u,p
}
Does this say: for each host in Mem-HG. Mem is dependent on PQL. Only alert Service A if Service C is also in a Hard-state Critical?
This is where my confusion comes in. "Nagios gets the current status* of the service that is being depended upon."
Given generic hosts a0,a1,a2 in Service A-HG & c0,c1,c2 as members of Service C-HG and the services listed above. Nagios kicks off the check for Service A which arguably is three services: service A::Host_a0; service A::Host_a1; service A::Host_a2. Similarly for Service C.
Basically, Can you confirm that this does an element-wise check?
Said another way; imagine that I have hosts x,y,z as members of Mem-Hg. Further, host y is in a state that would trigger a notification (namely Service A is critical & Service C is also critical; both sharing host y as a member of those services), despite the fact that the HG contains other elements that are in say OK states, only host y would result in the expected behavior of sending out an alert. Correct?
Case0 host x is a member of Service A-HG & host x is a member of Service B-HG
Is it checking the status of service A with respect to host x against status of service C with respect to host x
Case1 x is a member of A; x is NOT a member of C
Which service is Service A depending upon? There is no service C with respect to host x
Case2 x is NOT a member of A; x is a member of C
I assume this is OK?
I addded both case1 & case2 I was able to apply the configuration with both. I was not however able to have both Service A dependent upon Service C & Service C is dependent upon Service A. Having both dependencies active at the same time resulted in an "Error: Circular notification dependency detected for services..."
1.B Can I make use of the "Same Host Dependency"?
define servicedependency{
host_name HOST1,HOST2, ... HostN
service_description SERVICE C
dependent_service_description Service A
notification_failure_criteria o,w,u,p
}
Does this say: for each host Mem is dependent on PQL. Only alert Service A if Service C is also in a Hard-state Critical?
Please confirm that all the Hosts in "host_name" would be equivalent to all the hosts in the mem-HG?
as above, I assume this is on a by host basis?
Case2 Soln:
2.A Can I make use of the "All Hosts In Multiple Hostgroups"
define servicedependency{
hostgroup_name HOSTGROUP C
service_description Service C
dependent_hostgroup_name HOSTGROUP B
dependent_service_description SERVICE B
notification_failure_criteria o,w,u,p
}
define servicedependency{
hostgroup_name HOSTGROUP D
service_description Service D
dependent_hostgroup_name HOSTGROUP B
dependent_service_description SERVICE B
notification_failure_criteria o,w,u,p
}
Do I need "Inherits parents" or will Nagios understand that Service B is dependent upon Service C & D both being critical?
If I need "Inherits parents" which should receive it?
Thanks,
Maxwell Ramirez
I'm trying to set up Service Dependencies. I lay out the use case, variables, then present my solutions. Please respond to the questions in red. Further, please let me know if my understanding is incorrect and let me know the best way to implement this, if it is contrary to one of the solutions given below.
I make use of your documentation:
https://assets.nagios.com/downloads/nag ... tions.html
https://assets.nagios.com/downloads/nag ... ricks.html
Motivation:
Case1: OCC wants to be alerted for Mem if Mem & Processor Queue Length are both critical.
Case2: OCC wants to be alerted for Mem_db if Mem_db, Processor Queue Length, & “sqlservr” process CPU are all critical.
Service A := Mem
Service B := Mem_db
Service C := Processor Queue Length (PQL)
Service D := “sqlservr” process CPU (PCPU)
Each of the associated Services has a constituent HostGroup named similarly (eg Service A: Mem::Mem-Hg)
Universe All Windows Hosts.
Elementwise Hostgroup C is equivalent to the universe -- All hosts get the PQL Service.
Elementwise Hostgroup B is equivalent to Hostgroup D -- All SQL hosts
Elementwise Hostgroup A is the complement to Hostgroup B/D --Non-SQL hosts; equivalently universe - All SQL hosts
Case1 Soln:
1.A Can I make use of the "All Hosts In Multiple Hostgroups"
define servicedependency{
hostgroup_name HOSTGROUP C
service_description Service C
dependent_hostgroup_name HOSTGROUP A
dependent_service_description SERVICE A
notification_failure_criteria o,w,u,p
}
Does this say: for each host in Mem-HG. Mem is dependent on PQL. Only alert Service A if Service C is also in a Hard-state Critical?
This is where my confusion comes in. "Nagios gets the current status* of the service that is being depended upon."
Given generic hosts a0,a1,a2 in Service A-HG & c0,c1,c2 as members of Service C-HG and the services listed above. Nagios kicks off the check for Service A which arguably is three services: service A::Host_a0; service A::Host_a1; service A::Host_a2. Similarly for Service C.
Basically, Can you confirm that this does an element-wise check?
Said another way; imagine that I have hosts x,y,z as members of Mem-Hg. Further, host y is in a state that would trigger a notification (namely Service A is critical & Service C is also critical; both sharing host y as a member of those services), despite the fact that the HG contains other elements that are in say OK states, only host y would result in the expected behavior of sending out an alert. Correct?
Case0 host x is a member of Service A-HG & host x is a member of Service B-HG
Is it checking the status of service A with respect to host x against status of service C with respect to host x
Case1 x is a member of A; x is NOT a member of C
Which service is Service A depending upon? There is no service C with respect to host x
Case2 x is NOT a member of A; x is a member of C
I assume this is OK?
I addded both case1 & case2 I was able to apply the configuration with both. I was not however able to have both Service A dependent upon Service C & Service C is dependent upon Service A. Having both dependencies active at the same time resulted in an "Error: Circular notification dependency detected for services..."
1.B Can I make use of the "Same Host Dependency"?
define servicedependency{
host_name HOST1,HOST2, ... HostN
service_description SERVICE C
dependent_service_description Service A
notification_failure_criteria o,w,u,p
}
Does this say: for each host Mem is dependent on PQL. Only alert Service A if Service C is also in a Hard-state Critical?
Please confirm that all the Hosts in "host_name" would be equivalent to all the hosts in the mem-HG?
as above, I assume this is on a by host basis?
Case2 Soln:
2.A Can I make use of the "All Hosts In Multiple Hostgroups"
define servicedependency{
hostgroup_name HOSTGROUP C
service_description Service C
dependent_hostgroup_name HOSTGROUP B
dependent_service_description SERVICE B
notification_failure_criteria o,w,u,p
}
define servicedependency{
hostgroup_name HOSTGROUP D
service_description Service D
dependent_hostgroup_name HOSTGROUP B
dependent_service_description SERVICE B
notification_failure_criteria o,w,u,p
}
Do I need "Inherits parents" or will Nagios understand that Service B is dependent upon Service C & D both being critical?
If I need "Inherits parents" which should receive it?
Thanks,
Maxwell Ramirez