Page 2 of 2

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

Posted: Mon Aug 13, 2018 5:49 pm
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

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

Posted: Tue Aug 14, 2018 7:42 am
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

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

Posted: Tue Aug 14, 2018 8:13 am
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.

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

Posted: Tue Aug 14, 2018 8:26 am
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