Imported Configuration Truncated?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
XenoPhage
Posts: 56
Joined: Sun Jun 03, 2012 11:37 am

Imported Configuration Truncated?

Post by XenoPhage »

Hi there,

I'm in the process of importing a decent sized Core configuration into a new Nagios XI installation. I've followed the instructions for the XI Config Import Pre Tool and received no errors during the process. After the new configurations were created, I followed the instructions for importing them into XI.

The import itself went fine, also with no errors. However, when I get to the post-import process, I start to have problems. The first two steps of the "Write Config Files" process worked fine, no errors. When I hit the third step, check configuration files, I get the following error :

Error: Could not find any host matching 'server12.exampl' (config file '/usr/local/nagios/etc/services/_multiple_hosts.cfg', starting on line 1184)
Error: Could not expand hostgroups and/or hosts specified in service (config file '/usr/local/nagios/etc/services/_multiple_hosts.cfg', starting on line 1184)
Error processing object config files!

If I look at the config file mentioned, it's pretty clear that the data was truncated while being written out. Here's the definition in question (Though there are more in the config like this)

define service {
service_description Available Memory
use service-server-standard
hostgroup_name linux-server-critical,linux-server-standard,nac-appliance-standard
servicegroups linux-server-standard
check_command check_snmp_memory!-C $USER3$
host !server1.example.com,!server2.example.com,!server3.example.com,!server4.example.com,!server5.example.com,!server6.example.com,!server7.example.com,!server8.example.com,!server9.example.com,!server10.example.com,!server11.example.com,!server12.exampl
register 1
}

So how does one go about fixing this? Yes, I have really long host entries like this in the original config, and they work fine.

Server details :

RHEL 6.3
x86_64 architecture
4G RAM
4 CPUs
Nagios XI 2011r3.2 (Manual Install)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Imported Configuration Truncated?

Post by scottwilkerson »

As far as I am aware, I don't believe that NagiosQL (used to manage configs in Nagios XI) supports negated hosts, I believe these will need to be managed in the static sub-directory of /usr/local/nagios/etc
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
XenoPhage
Posts: 56
Joined: Sun Jun 03, 2012 11:37 am

Re: Imported Configuration Truncated?

Post by XenoPhage »

Ah, I didn't see that in the documentation.. For what it's worth, though, it does appear to be importing properly, and then exporting the proper format, albeit truncated.

So how do I handle this? Do I have to remove anything that uses a negated host from the config and put it in the static directory?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Imported Configuration Truncated?

Post by scottwilkerson »

XenoPhage wrote:So how do I handle this? Do I have to remove anything that uses a negated host from the config and put it in the static directory?
This would be correct, at least at this time.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
XenoPhage
Posts: 56
Joined: Sun Jun 03, 2012 11:37 am

Re: Imported Configuration Truncated?

Post by XenoPhage »

scottwilkerson wrote:
XenoPhage wrote:So how do I handle this? Do I have to remove anything that uses a negated host from the config and put it in the static directory?
This would be correct, at least at this time.
So this is interesting.. I dug into this more and what the parser did was to move that hosts line into the SQL back end as a free variable definition. Is that a valid way to do this? We use negation pretty extensively for a bunch of service definitions and having to move that to a static file outside of the web ui would cause problems..
XenoPhage
Posts: 56
Joined: Sun Jun 03, 2012 11:37 am

Re: Imported Configuration Truncated?

Post by XenoPhage »

Hrm.. scratch that.. I'm betting the fields in SQL for these variables are not TEXT, but some pre-sized CHAR field, and thus the truncation.

Damn.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Imported Configuration Truncated?

Post by mguthrie »

If you can send me a PM with a sample of the config you're trying to import, I can probably identify the issue.

Relationships for hosts, hostgroups, etc can't actually be truncated, they're stored in separate relationship tables, so the issue is most likely character related. If you've got a # or \ character anywhere that could be causing the issue...
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Imported Configuration Truncated?

Post by mguthrie »

It looks like your service config is using the deprecated host config directive, instead of host_name. I think the importer is trying to import the 'host' line as a custom variable, instead of building the host list. However, the other dilemma is that currently the Core Config Manager does not support exclusions.

That gives me an idea though and I might experiment and see if I can enter host exclusions as custom variables....
XenoPhage
Posts: 56
Joined: Sun Jun 03, 2012 11:37 am

Re: Imported Configuration Truncated?

Post by XenoPhage »

mguthrie wrote:It looks like your service config is using the deprecated host config directive, instead of host_name. I think the importer is trying to import the 'host' line as a custom variable, instead of building the host list. However, the other dilemma is that currently the Core Config Manager does not support exclusions.

That gives me an idea though and I might experiment and see if I can enter host exclusions as custom variables....
Oh, host was deprecated? Hrm.. I missed that apparently. But yeah, exclusions would be useful.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Imported Configuration Truncated?

Post by mguthrie »

Interesting trick we discovered from this thread. If you're using *only* service->hostgroup assignments in a service definition, you can actually pass exclusions as a free variable and Nagios Core will honor the definition. So if you don't have any inclusive host assignments in a service definition you could add as a free variable:

host_name
!host1,!host2,!host3

You would of course be subject to the VARCHAR limit of that table, but that could easily be remedied with an ALTER TABLE query.
Locked