Closed N-Mi closed 9 years ago
I will try to add a testcase, reproduce and fix it :)
You have two "use" attributes in your "squeeze" host definition. Perhaps this contributes somehow to the problem...
define host{ name squeeze register 0 use generic-host icon_set server use linux-snmp,ssh _SNMPCOMMUNITY aaaaaaaaaaaaaaaaaaaaaa _MAILTAG [SYS] }
I have no problem with the same constellation of +contact_groups in our Shinken 2.4 config.
I've just modified the squeeze template like this :
# Debian Squeeze
define host{
name squeeze
register 0
icon_set server
use linux-snmp,ssh,generic-host
_SNMPCOMMUNITY aaaaaaaaaaaaaaaaaaaaaa
_MAILTAG [SYS]
}
And I still get the error message.
I could reproduce this error. It occours if an additive field (+attribute) is referenced by more than one template. So I guess one of your templates "linux-snmp" or "ssh" also has a "use" attribute that contains "generic-host"?
According to Shinken docs the first value found should be used:
Important
If you use a field twice using several templates, the value of the field will be the first one found! In the example above, fields values in all-servers won’t we be replaced. Be careful with overlaping field!
But seems like this is a case of an overlapping field, where the value gets lost somehow because of additive inheritance chaining. Anyway, I think the problem is eliminated if you make sure that the "generic-host" template is used only once in the chain...
Indeed, the "linux-snmp" pack has a "use generic-host" directive in its template.
I removed "generic-host" in the squeeze template, and now it works.
My guess is it develops the contact_groups to "+admins,+admins", then remove the second because it's duplicate and keeps "+admins,+" instead of "+admins", which leads to the checkconfig error.
(it's just a guess of what happens, I didn't had a look in the code to validate this)
Cool ! I manage to reproduce it. I try to fix it :)
Hello,
could you test with master version ?
Regards
Hi Olivier, I installed the current master version and did the same testst to try to reproduce this error... and everything works fine now! Nice fix! :)
I can confirm this fixes the issue.
Thanks !
Hi,
I'm setting a new 2.4 server to replace my old 1.4.2.
I have the following error message when doing a configcheck :
Here are interesting config snippets :
The same host and templates definition works fine in 1.4.2 If I remove the "+" in contact_groups paramter in generic-host, the checkconfig works fine. If I add "contact_groups developers" to server1, it works also (and I guess admins and developers will be notified, not tried yet).
So it seems there is a problem when doing additive inheritance to an unset variable.