Importing Config Files
Posted: Fri Dec 11, 2020 12:10 pm
Hi
We have written a powershell script to take a CSV file and generate host and service config objects that we want to import into Nagios XI.
As a test we generate a file called:
<hostname>.cfg
The contents are:
define host {
host_name <hostname>
use <template name>
address <FQDN>
parents <host1>,<host2>
}
I put it in the /usr/local/nagios/etc/import folder. Then run the xiprepimport check against it. There is no output or change or new files created. I then import through the UI.
It errors with "Table for import definition '" is not available!".
There are now 2 <hostname>.cfg files. One in the import folder and another in the /etc parent folder. The one in the /etc folder contains the same information as the one in import folder.
"Apply Configuration" now is failing with an error "Could not register service (config file '/usr/local/nagions/etc/services/<hostname>.cfg',starting on line 30".
This is bizzare as there are no services assigned to that configuration, its just a host.
The file '/usr/local/nagions/etc/services/<hostname>.cfg' does not exist, and there is no such configuration in the dropdown for the services, so there is no way I can fix it from the UI.
The only option is to reverse to snapshot, so I am bit confused and unsure how to progress.
rgds
G
We have written a powershell script to take a CSV file and generate host and service config objects that we want to import into Nagios XI.
As a test we generate a file called:
<hostname>.cfg
The contents are:
define host {
host_name <hostname>
use <template name>
address <FQDN>
parents <host1>,<host2>
}
I put it in the /usr/local/nagios/etc/import folder. Then run the xiprepimport check against it. There is no output or change or new files created. I then import through the UI.
It errors with "Table for import definition '" is not available!".
There are now 2 <hostname>.cfg files. One in the import folder and another in the /etc parent folder. The one in the /etc folder contains the same information as the one in import folder.
"Apply Configuration" now is failing with an error "Could not register service (config file '/usr/local/nagions/etc/services/<hostname>.cfg',starting on line 30".
This is bizzare as there are no services assigned to that configuration, its just a host.
The file '/usr/local/nagions/etc/services/<hostname>.cfg' does not exist, and there is no such configuration in the dropdown for the services, so there is no way I can fix it from the UI.
The only option is to reverse to snapshot, so I am bit confused and unsure how to progress.
rgds
G