Strange Inheritance bug?

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Strange Inheritance bug?

Postby Cartaugrapher » Tue Feb 13, 2018 2:11 pm

Hello, all.
I've been setting up nagios for a little while here, and after finishing a fairly long list of hosts, hostgroups, services, and such; I've come to some strange bugs in some inheritances.

I'm using hostgroups for more easy control (we have a number of different servers running a plethora of services), so the inheritance looks like this:

Service -> hostgroup(s) -> hosttemplate(s) -> hosts

So interestingly, I've been getting a few errors that don't make sense. a number of them have been solved by fiddling with names and such, but most of the errors and such are nonsensical, given the situation:

Error:
Code: Select all
Error: Unable to locate host 'linux-mail' for service 'IMAP on port 143'
Error: Could not register service (config file '/opt/nagios/etc/objects/services.cfg', starting on line 61)


Service Block:
Code: Select all
define service{
        name                    IMAP
        use                     generic-service
        hostgroup_name          mail-servers
        service_description     IMAP on port 143
        check_command           check_imap
}


Hostgroup Block:
Code: Select all
define hostgroup{
        hostgroup_name  mail-servers
        alias           Incoming Mail Servers
        members         linux-mail
}


Host Template Block:
Code: Select all
define host{
        host_name                       linux-mail
        name                            linux-mail
        use                             linux-server
        register                        0
}


And a sanitized Host Block:
Code: Select all
define host{
        host_name       $Hostname_here
        address         $Address_here
        use             linux-mail
        register        1
}


Has anyone seen anything similar to this? Any thoughts on fixes?
Cartaugrapher
 
Posts: 2
Joined: Tue Feb 13, 2018 1:50 pm

Re: Strange Inheritance bug?

Postby lmiltchev » Tue Feb 13, 2018 3:24 pm

First thing I noticed is that you have an extra (wrong) directive in your template definition ("host_name"). For more info: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectinheritance.html
define host{
host_name linux-mail
name linux-mail
use linux-server
register 0
}

Change it to:
Code: Select all
define host{       
        name                            linux-mail
        use                             linux-server
        register                        0
}


Do you see any config errors now, when you verify the configuration?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 10304
Joined: Mon May 23, 2011 12:15 pm

Re: Strange Inheritance bug?

Postby Cartaugrapher » Tue Feb 13, 2018 3:41 pm

lmiltchev wrote:First thing I noticed is that you have an extra (wrong) directive in your template definition ("host_name"). For more info: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectinheritance.html
define host{
host_name linux-mail
name linux-mail
use linux-server
register 0
}

Change it to:
Code: Select all
define host{       
        name                            linux-mail
        use                             linux-server
        register                        0
}


Do you see any config errors now, when you verify the configuration?



The hostgroup inheritance doesn't seem to work correctly with just name (and not host_name), giving me the following:

Code: Select all
Error: Could not find any host matching 'linux-mail' (config file '/opt/nagios/etc/objects/hostgroups.cfg', starting on line 43)
Error: Could not expand members specified in hostgroup (config file '/opt/nagios/etc/objects/hostgroups.cfg', starting on line 43)
Cartaugrapher
 
Posts: 2
Joined: Tue Feb 13, 2018 1:50 pm

Re: Strange Inheritance bug?

Postby lmiltchev » Wed Feb 14, 2018 10:10 am

Zip up the "/opt/nagios/etc/" directory, and PM me (or any other member of the Nagios Support team) the zip file. We will review the configs, and suggest a solution.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 10304
Joined: Mon May 23, 2011 12:15 pm


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 3 guests

cron