Challenge with object inheritance
Posted: Thu Feb 11, 2021 11:45 am
Ahoy folks,
I have a bit of an "inheritance" bind, by the feel of it.
I am attempting to leverage the magic of inheritance via a combo of SERVICE TEMPLATES and SERVICE DEFINITIONS.
In the present scenario, this would be paired with ACTIVE monitor checks against a collection of Oracle dBs.
I already have this going using one SERVICE TEMPLATE, to many SERVICE DEFINITIONS
However, that felt less than elegant, with some duplication of settings / effort.
To this end, I though to try and "bake more" into the TEMPLATES level, leaving the DEFINITIONS level cleaner for the specifics of the specific instance of monitor.
Thus, I created the following (as detailed below, for reference sake).
Do note, I am using Custom Variables to "load" the SID, UN, and PASSWD values on a per SERVICE DEFINITION basis.
On the surface, I would have expected the SERVICE TEMPLATE to grant "partial inheritance" of its completed values, to be passed down to the SERVICE DEFINITIONS that are associated to "use" it.
While this mostly works (as has been the case with a number of other monitors in play), I note a strange behavior.
Do observe that while I have clearly different TEMPLATE & DEFINITIONS, for some reason the DEFINITIONS "Free Variables" are cross-pollinating into one-another.
This manifests when I look at my SERVICE STATUS panel within XI, and also in the object.cache file on disk.
I reviewed the vendor docs for Nagios CORE (Object Inheritance With Templates), and went so far as to create versions of the Free Variables with "null" as their values.
This ultimately proved in-effective however.
Curious to know how I might avoid this behavior?
Signed,
-Rowan
---
XI: 5.6.x
MariaDB: 5.5.64.x (off-box)
CCM: 3.0.5
CORE: 4.x
https://assets.nagios.com/downloads/nag ... tance.html
---
# service_template
```
define service {
name TEAM_oracletablespace_service_connection-time
hostgroup_name dba-servers_oracle
service_description TEAM_oracletablespace_service_connection-time
servicegroups TEAM-oracle-monitors
check_command CUSTOM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
initial_state o
max_check_attempts 5
check_interval 5
retry_interval 1
active_checks_enabled 1
check_period 24x7
event_handler_enabled 0
flap_detection_enabled 0
process_perf_data 1
notification_period 24x7
notification_options w,c,u,r,
notifications_enabled 1
contact_groups TEAM-info
register 0
}
```
# service_definitions
## def1
```
define service {
host_name host1.fqdn
service_description connection-time: ora1.host1.fqdn
use TEAM_oracletablespace_service_connection-time
_oracle_sid ora1
_passwd S3cr3TP4ssW0rD
_un dba_admin
register 1
}
```
## def2
```
define service {
host_name host2.fqdn
service_description connection-time: ora2.host2.fqdn
use TEAM_oracletablespace_service_connection-time
_oracle_sid ora2
_passwd S3cr3TP4ssW0rD
_un dba_admin
register 1
}
```
# /usr/local/nagios/var/objects.cache
```
define service {
host_name host1.fqdn
service_description connection-time: ora1.host1.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 2.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora1
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
...
define service {
host_name host1.fqdn
service_description connection-time: ora2.host2.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 2.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora2
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
...
define service {
host_name host2.fqdn
service_description connection-time: ora1.host1.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 20.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora1
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
...
define service {
host_name host2.fqdn
service_description connection-time: ora2.host2.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 20.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora2
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
```
I have a bit of an "inheritance" bind, by the feel of it.
I am attempting to leverage the magic of inheritance via a combo of SERVICE TEMPLATES and SERVICE DEFINITIONS.
In the present scenario, this would be paired with ACTIVE monitor checks against a collection of Oracle dBs.
I already have this going using one SERVICE TEMPLATE, to many SERVICE DEFINITIONS
However, that felt less than elegant, with some duplication of settings / effort.
To this end, I though to try and "bake more" into the TEMPLATES level, leaving the DEFINITIONS level cleaner for the specifics of the specific instance of monitor.
Thus, I created the following (as detailed below, for reference sake).
Do note, I am using Custom Variables to "load" the SID, UN, and PASSWD values on a per SERVICE DEFINITION basis.
On the surface, I would have expected the SERVICE TEMPLATE to grant "partial inheritance" of its completed values, to be passed down to the SERVICE DEFINITIONS that are associated to "use" it.
While this mostly works (as has been the case with a number of other monitors in play), I note a strange behavior.
Do observe that while I have clearly different TEMPLATE & DEFINITIONS, for some reason the DEFINITIONS "Free Variables" are cross-pollinating into one-another.
This manifests when I look at my SERVICE STATUS panel within XI, and also in the object.cache file on disk.
I reviewed the vendor docs for Nagios CORE (Object Inheritance With Templates), and went so far as to create versions of the Free Variables with "null" as their values.
This ultimately proved in-effective however.
Curious to know how I might avoid this behavior?
Signed,
-Rowan
---
XI: 5.6.x
MariaDB: 5.5.64.x (off-box)
CCM: 3.0.5
CORE: 4.x
https://assets.nagios.com/downloads/nag ... tance.html
---
# service_template
```
define service {
name TEAM_oracletablespace_service_connection-time
hostgroup_name dba-servers_oracle
service_description TEAM_oracletablespace_service_connection-time
servicegroups TEAM-oracle-monitors
check_command CUSTOM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
initial_state o
max_check_attempts 5
check_interval 5
retry_interval 1
active_checks_enabled 1
check_period 24x7
event_handler_enabled 0
flap_detection_enabled 0
process_perf_data 1
notification_period 24x7
notification_options w,c,u,r,
notifications_enabled 1
contact_groups TEAM-info
register 0
}
```
# service_definitions
## def1
```
define service {
host_name host1.fqdn
service_description connection-time: ora1.host1.fqdn
use TEAM_oracletablespace_service_connection-time
_oracle_sid ora1
_passwd S3cr3TP4ssW0rD
_un dba_admin
register 1
}
```
## def2
```
define service {
host_name host2.fqdn
service_description connection-time: ora2.host2.fqdn
use TEAM_oracletablespace_service_connection-time
_oracle_sid ora2
_passwd S3cr3TP4ssW0rD
_un dba_admin
register 1
}
```
# /usr/local/nagios/var/objects.cache
```
define service {
host_name host1.fqdn
service_description connection-time: ora1.host1.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 2.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora1
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
...
define service {
host_name host1.fqdn
service_description connection-time: ora2.host2.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 2.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora2
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
...
define service {
host_name host2.fqdn
service_description connection-time: ora1.host1.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 20.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora1
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
...
define service {
host_name host2.fqdn
service_description connection-time: ora2.host2.fqdn
check_period 24x7
check_command TEAM_check_xi_oracle_connection-time!--connect '$HOSTADDRESS$:1521/$_SERVICEORACLE_SID$' --username '$_SERVICEUN$' --password '$_SERVICEPASSWD$'!!!!!!!
contact_groups TEAM-info
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 5
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 0
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 0
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 20.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
_ORACLE_SID ora2
_PASSWD S3cr3TP4ssW0rD
_UN dba_admin
}
```