Page 1 of 3
Errors importing cfg files into Nagios XI
Posted: Mon Apr 07, 2014 3:22 pm
by rickwilson7425
I am testing the Nagios XI VM which I downloaded. We want to migrate our existing Nagios Core setup to Nagios XI.
I get as far as using the prep tool on the services.cfg file and get this error - "PHP Notice: Undefined offset: 1 in /usr/local/nagiosxi/tools/xiprepimport.php on line 102"
None of the other CFG files throw this error.
I went ahead and tried to write the file and get this error - "Error: Template 'generic-host-nix' specified in host definition could not be not found (config file '/usr/local/nagios/etc/hosts/dendbd3.cfg', starting on line 14)
Error processing object config files!"
The "generic-host-nix" is defined in the Templates.cfg file.
Is the PHP error relevant?
Why would I be getting the Template error if it is defined in the CFG file?
Thanks for you help.
Re: Errors importing cfg files into Nagios XI
Posted: Mon Apr 07, 2014 3:26 pm
by tmcdonald
rickwilson7425 wrote:The "generic-host-nix" is defined in the Templates.cfg file.
Is it "Templates.cfg" or "templates.cfg"? Capitalization matters.
Also, try running the config import prep tool against the template files first before the services file.
Re: Errors importing cfg files into Nagios XI
Posted: Tue Apr 08, 2014 9:29 am
by rickwilson7425
It is templates.cfg - no capital letter
Tried running prep on templates.cfg first and then on services.cfg - still get the error.
FYI - The error line is repeated about 80 times.
I didn't check before but there is nothing in the services.cfg file that the prep tool creates. I suppose that is why I am getting the error when I try to write the file in Core Config.
Re: Errors importing cfg files into Nagios XI
Posted: Tue Apr 08, 2014 11:14 am
by abrist
If you run the prep tools on templates.cfg, finish the import into xi (including applying config), and then attempt to prep and import the host and service configs, do you still get errors in the import process or ccm?
Re: Errors importing cfg files into Nagios XI
Posted: Tue Apr 08, 2014 11:29 am
by rickwilson7425
I tried just importing templates but when I wrote the file and verified it it still has that error.
Maybe I should just wipe out all the configs and start over? If so, what would be the quickest way to do that?
Re: Errors importing cfg files into Nagios XI
Posted: Tue Apr 08, 2014 12:22 pm
by rickwilson7425
I set up a new VM and ran through the process as you suggested.
It still fails on prepping the services.cfg file which results in an empty file.
Re: Errors importing cfg files into Nagios XI
Posted: Wed Apr 09, 2014 12:37 pm
by abrist
Can you post the errors that are output from the import?
were there any errors in the prep process?
Re: Errors importing cfg files into Nagios XI
Posted: Wed Apr 09, 2014 2:07 pm
by rickwilson7425
There main problem appears to be in the prep process. I get this error trying to prep the services.cfg file:
"PHP Notice: Undefined offset: 1 in /usr/local/nagiosxi/tools/xiprepimport.php on line 102"
Re: Errors importing cfg files into Nagios XI
Posted: Wed Apr 09, 2014 4:19 pm
by tmcdonald
Can you PM that services.cfg file to me? Looking at the code it seems there is a misconfiguration in that file that is causing the import to choke.
Re: Errors importing cfg files into Nagios XI
Posted: Thu Apr 10, 2014 12:40 pm
by tmcdonald
Looking through your services.cfg I noticed there are several blank fields that are causing the import process to break. For example, you have a lot of instances like this one:
Code: Select all
define service {
service_description SSH Connection
host_name
hostgroup_name hgroup1,hgroup2,hgroup3,hgroup4
use template1
check_command check_ssh
contact_groups cgroup1,cgroup2
}
I changed the values of course so as not to post your real config on the forum, but as you can see host_name is blank. This is causing the undefined error on your import.
The empty fields are all the following:
contact_groups
contacts
_COSTCENTER
hostgroup_name
host_name
notes
notes_url
_RUN
You will either need to remove those empty lines or fill them in.