Errors importing cfg files into Nagios XI
-
rickwilson7425
- Posts: 125
- Joined: Tue Mar 18, 2014 3:20 pm
Errors importing cfg files into Nagios XI
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.
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
Is it "Templates.cfg" or "templates.cfg"? Capitalization matters.rickwilson7425 wrote:The "generic-host-nix" is defined in the Templates.cfg file.
Also, try running the config import prep tool against the template files first before the services file.
Former Nagios employee
-
rickwilson7425
- Posts: 125
- Joined: Tue Mar 18, 2014 3:20 pm
Re: Errors importing cfg files into Nagios XI
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.
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
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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
rickwilson7425
- Posts: 125
- Joined: Tue Mar 18, 2014 3:20 pm
Re: Errors importing cfg files into Nagios XI
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?
Maybe I should just wipe out all the configs and start over? If so, what would be the quickest way to do that?
-
rickwilson7425
- Posts: 125
- Joined: Tue Mar 18, 2014 3:20 pm
Re: Errors importing cfg files into Nagios XI
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.
It still fails on prepping the services.cfg file which results in an empty file.
Re: Errors importing cfg files into Nagios XI
Can you post the errors that are output from the import?
were there any errors in the prep process?
were there any errors in the prep process?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
rickwilson7425
- Posts: 125
- Joined: Tue Mar 18, 2014 3:20 pm
Re: Errors importing cfg files into Nagios XI
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"
"PHP Notice: Undefined offset: 1 in /usr/local/nagiosxi/tools/xiprepimport.php on line 102"
Re: Errors importing cfg files into Nagios XI
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.
Former Nagios employee
Re: Errors importing cfg files into Nagios XI
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:
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.
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
}
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.
Former Nagios employee