Page 1 of 2
XI Config Import Prep Tool
Posted: Tue Sep 02, 2014 8:23 pm
by jkinning
I am still in the process of migrating over from Nagios Core to Nagios XI. I am running my cfg files from Nagios Core into XI but I have a directory in /usr/local/nagios/etc/contacts which has multiple user .cfg files along with other directories like pager, which have phone SMS numbers and alpha numeric pager numbers, view only to only view the web GUI. Is there an easy way to have the xiprepimport scripts take all the .cfg files within the top level directory /usr/local/nagios/etc/contacts and work it's magic and make these .cfg files ready in the /usr/local/nagios/etc/cfgprep directory?
I'm trying to follow the order that Nagios XI is recommending and don't have just one contacts.cfg file but multiple individual files. Any thoughts or recommendations?
Re: XI Config Import Prep Tool
Posted: Wed Sep 03, 2014 9:45 am
by lmiltchev
If you have multiple "contact" configs, you will need to run the config import prep tool against each source configuration file.
Re: XI Config Import Prep Tool
Posted: Wed Sep 03, 2014 12:55 pm
by jkinning
In case this will help anyone else here is what I used.
Code: Select all
#!/bin/bash
find /root/nagios/<directory with sub directories> -type f -name "*.cfg" | while read cfg; do
php /usr/local/nagiosxi/tools/xiprepimport.php "$cfg";
done
I have been working on this for 2 days now and still can't get my old Nagios stuff into Nagios XI. I am attaching the error log when I try to apply the configuration.
Re: XI Config Import Prep Tool
Posted: Wed Sep 03, 2014 1:02 pm
by lmiltchev
Can you post the "/usr/local/nagios/etc/serviceescalations.cfg" file?
Re: XI Config Import Prep Tool
Posted: Wed Sep 03, 2014 2:52 pm
by jkinning
###############################################################################
#
# Service escalations configuration file
#
# Created by: Nagios Core Config Manager 2.2.0
# Date: 2014-09-03 07:48:59
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
###############################################################################
#
# Service escalations configuration file
#
# END OF FILE
#
###############################################################################
Re: XI Config Import Prep Tool
Posted: Thu Sep 04, 2014 7:26 am
by jkinning
I deactivated the entries I had listed in the Service Escalation window of the UI. I don't understand how they can be present there but not written to the config file which is tossing up the errors.
Re: XI Config Import Prep Tool
Posted: Thu Sep 04, 2014 11:08 am
by slansing
How did you import your config files? The order does matter and is outlined in the web UI before you import. This could have been caused by importing in the wrong order, or importing certain configs (escalations), then stopping, and importing the rest later (including the dependent hosts).
Re: XI Config Import Prep Tool
Posted: Thu Sep 04, 2014 2:57 pm
by jkinning
I imported those files in that order. Strange and I am also missing some service checks so I don't thing the import was really that helpful or successful.
Re: XI Config Import Prep Tool
Posted: Thu Sep 04, 2014 3:27 pm
by lmiltchev
The configs won't be written if there are config errors. It is always a good idea to verify your configuration using the Write Config Tool (after importing files), BEFORE applying configuration. Config Import Proep Tools is not perfect but it does a pretty good job in the majority of the cases. I am surprised you are having so many issues. Can you apply configuration successfully now?
Re: XI Config Import Prep Tool
Posted: Fri Sep 05, 2014 10:56 am
by jkinning
Luckily this is a VM which I took a snapshot prior too starting this conversion. I'll revert back to my original state and go through the import again this time using the Write Config File option as well.
I wouldn't think migrating all the cfg files from Nagios Core to Nagios XI would be so daunting.