opinkerfi / okconfig

Ready made monitoring packs for Nagios
GNU General Public License v3.0
45 stars 28 forks source link

Error: Template 'linux-server' specified in host definition could not be found (config file '/etc/nagios/okconfig/hosts/mygroup/myhost-host.cfg', starting on line 3) #54

Closed ramiro closed 10 years ago

ramiro commented 10 years ago

Steps to reproduce:

  1. Install and configure OKConfig + adagios.
  2. Using the adagios Web UI, create a 'mygroup' host group the OKConfig way.
  3. Using the adagios Web UI, create a 'myhost' host the OKConfig way. Make it a member of the above group
  4. Perform any action that involves Nagios verifying the configuration.

It produces the above error message. The host definition OKConfig created inherits from a 'linux-server' template o abstract host definition that isn't shipped either with OKConfig, pynag or adagios, nor with the Nagios default configuration.


define host {
    use                         linux-server
...

reading the OKConfig source code, this section shows other templates names 'windows-server' and 'generic-switch' are used that don't exist either.

pall-valmundsson commented 10 years ago

I've seen this too. I thought it had something to do with some hack in my setup and hadn't bothered to track it down. My way to reproduce the use linux-server issue:

okconfig addhost somehost.foo.local --group somegroup --template linux,dns

While this makes the host depend on okc-default-host with identical config:

okconfig addhost somehost.foo.local --group somegroup
okconfig addtemplate somehost.foo.local --template linux,dns
palli commented 10 years ago

quick workaround is to run:

pynag add host host_name=linux-server use=generic-host

I'm going to take a look at what is going on in the code.

palli commented 10 years ago

ps: linux-server is distributed as part of nagios rpm on redhat. I am guessing @ramiro is running some other distribution.

ramiro commented 10 years ago

That's right. I'm using Debian.

It seems at least one distribution modifies the configuration shipped with Nagios. And it seem like neither of these mods are general enough.

It's a good thing okconfig doesn't depend on any of these arbitrary templates. ISTM safest choice would be to assume there are no previous definitions and the Nagios/Icinga configuration is fully managed by okconfig starting from a clean room scenario.

Thanks for the fix and for okconfig.