Importing Core config files....error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
[email protected]
Posts: 38
Joined: Fri Mar 28, 2014 9:27 am

Re: Importing Core config files....error

Post by [email protected] »

sreinhardt wrote:When I do our paid imports, I use the following commands to determine the order of import. Some things will absolutely get duplicated, and in some cases a few files may never get imported if they do not provide anything. Go through these in order, and import every file that each command says, at each step. Again you will almost definitely get duplicates, and some errors, but it should import everything in your configs. In your case, you might be able to better judge or separate out what needs to be imported when if you have the configs already separated out somewhat.

Code: Select all

grep -Ri 'define command{' ./ | sort -u
grep -Ri 'define timeperiod{' ./ | sort -u
grep -Ri 'define contact{' ./ | sort -u
grep -Ri 'define contact{' ./ | sort -u
grep -Ri 'define contactgroup{' ./ | sort -u
grep -Ri 'define host{' ./ | sort -u
grep -Ri 'define host{' ./ | sort -u
grep -Ri 'define hostgroup{' ./ | sort -u
grep -Ri 'define service{' ./ | sort -u
grep -Ri 'define service{' ./ | sort -u
grep -Ri 'define servicegroup{' ./ | sort -u
Note: I move the original files before importing begins, but after import prep happens, to make this all much more readable and so that you don't have to ignore ./orig/ files. Also you should run these commands from the cfgprep directory.
gotcha! Running them now, thanks!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Importing Core config files....error

Post by scottwilkerson »

This look correct and the order looks good also.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
[email protected]
Posts: 38
Joined: Fri Mar 28, 2014 9:27 am

Re: Importing Core config files....error

Post by [email protected] »

scottwilkerson wrote:This look correct and the order looks good also.
The only one that didn't return an entry is : grep -Ri 'define servicegroup{' ./ | sort -u

Apparently we didn't use service groups.....and that does sound right. We used host groups, but didn't group by services. So that makes sense. Is that ok?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Importing Core config files....error

Post by scottwilkerson »

[email protected] wrote:
scottwilkerson wrote:This look correct and the order looks good also.
The only one that didn't return an entry is : grep -Ri 'define servicegroup{' ./ | sort -u

Apparently we didn't use service groups.....and that does sound right. We used host groups, but didn't group by services. So that makes sense. Is that ok?
Totally normal, Many organizations do not use servicegroups.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
[email protected]
Posts: 38
Joined: Fri Mar 28, 2014 9:27 am

Re: Importing Core config files....error

Post by [email protected] »

Getting somewhere this is the error now:
Nagios Core 4.0.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 04-11-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in host type objects (config file '/usr/local/nagios/etc/hosttemplates.cfg', starting at line 22)
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in host type objects (config file '/usr/local/nagios/etc/hosttemplates.cfg', starting at line 100)
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in service type objects (config file '/usr/local/nagios/etc/servicetemplates.cfg', starting at line 14)
Error: Service escalation host name or description is NULL
Error: Could not register service escalation (config file '/usr/local/nagios/etc/serviceescalations.cfg', starting on line 33)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
After I got it to write to the file I DID check that and there are some hostgroups that don't have a 'host_name'. Even after editing that file and saving it......it appears that doesn't work. Is there a way to edit this pre import so it will work?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Importing Core config files....error

Post by sreinhardt »

Yes, but you might not have to. One of the biggest issues with importing, is that it will not import items that have missing dependencies, and in some cases this makes artifacts where definitions may be empty\null valued.

I would probably start by looking at your the serviceescalations.cfg and see which has the serviceescalation that is erroring for no hostname or description, then look at your post-importprep files and see which contains that escalation.
If it does have the proper information, try importing that file alone, one more time and see if the error is resolved.
If it is empty, you should feel free to add the necessary information to correct the issue and import. This should overwrite the DB's existing information and hopefully resolve it.
Otherwise this particular one is as easy as identifying the escalation from the flat file, and adding the missing definition within CCM. The choice is yours as to which way to use.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
[email protected]
Posts: 38
Joined: Fri Mar 28, 2014 9:27 am

Re: Importing Core config files....error

Post by [email protected] »

Ok I got it fixed.......sort of. With quite a bit of help from Nagios Customer support. We deactivated service escalations as that imported all kinds of weird. I'll likely have to add those in manually. Which isn't a big deal. Then permissions some how got messed up and even while troubleshooting they kept reverting back. Which was pretty odd. Then we found out one of the services didn't have a 'check command' for some reason. Guess that didn't come over, or was blank in the import file. We just deactivated that one for now. Once we did that we were able to save the configuration just fine. The most important thing is all the hosts and 99% of the services imported now. That's key as we have a TON of hosts we monitor.

So if someone comes across this and has issues this is what i've learned:
1. Remove duplicate and empty entries that somehow get created during the import prep(both under services and hosts)
2. Check to make sure all of your services have a check command
3. Make sure your service escalations are configured correctly.....or deactivate them and add them manually
4. Check permissions...there is a permissions set script /usr/local/nagiosxi/scripts/reset_config_perms


now I need to go edit the hosts so they report to the new nagios instance!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Importing Core config files....error

Post by slansing »

Awesome to hear! Yes, there is a snowball effect to importing configurations that are not totally complete, let us know if you have any other questions on this or if you are ready for us to lock this up.
[email protected]
Posts: 38
Joined: Fri Mar 28, 2014 9:27 am

Re: Importing Core config files....error

Post by [email protected] »

you can lock this one up! Thanks!
Locked