Inheritance doesn't seem to be working for config templates

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.
jlom
Posts: 17
Joined: Mon Dec 04, 2017 4:49 pm

Re: Inheritance doesn't seem to be working for config templa

Post by jlom »

No, verified.

Code: Select all

grep -r  systems-host /etc/nagios/objects/
/etc/nagios/objects/unix.ctx.cfg: name systems-host
/etc/nagios/objects/unix.ctx.cfg: name systems-host-defaults
/etc/nagios/objects/unix.ctx.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
/etc/nagios/objects/hosts.cfg: use systems-host
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Inheritance doesn't seem to be working for config templa

Post by scottwilkerson »

jlom wrote: Long story short, Here are some clips from my configs.

from nagios.cfg
cfg_file=/etc/nagios/objects/linux.ctx.cfg
cfg_file=/etc/nagios/objects/hosts.cfg
cfg_dir=/etc/nagios/objects/services

From hosts.cfg

Code: Select all

define host {
 host_name testbox1
 use systems-host
 notification_interval 1440
 contact_groups systems
 notification_period critical
}

From linux.ctg.cfg

Code: Select all

define host {
 name systems-host
 notifications_enabled 1
 flap_detection_enabled 1
 #failure_prediction_enabled 1
 retain_status_information 1
 retain_nonstatus_information 1
 max_check_attempts 2
 check_interval 3
 check_period critical
 check_command check_local!ping!
 register 0
}
Just re-read your first post and the filenames don't match, and are also different from what you found in your grep
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jlom
Posts: 17
Joined: Mon Dec 04, 2017 4:49 pm

Re: Inheritance doesn't seem to be working for config templa

Post by jlom »

Yeah, That was a typo on the post, the filenames were the same...


I found the issue last night.

It seems nagios will not parse the templates if there are existing config issues. In this case it was the empty "contacts" field We used it as a place holder in nagios 3 but apparently being empty in nagios 4 is a nono.


I cleared out all of the contacts errors and then it parsed the cconfig files in their entirety so max_check_attempts would work.

SO, that's it for anyone who is having a similar issue just posting it up here.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Inheritance doesn't seem to be working for config templa

Post by scottwilkerson »

jlom wrote:Yeah, That was a typo on the post, the filenames were the same...


I found the issue last night.

It seems nagios will not parse the templates if there are existing config issues. In this case it was the empty "contacts" field We used it as a place holder in nagios 3 but apparently being empty in nagios 4 is a nono.


I cleared out all of the contacts errors and then it parsed the cconfig files in their entirety so max_check_attempts would work.

SO, that's it for anyone who is having a similar issue just posting it up here.
Thanks for coming back and sharing your resolution!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked