Page 1 of 1

Importing Configs into fresh Nagios XI Server

Posted: Wed Nov 02, 2016 4:09 pm
by philip.ianni
Hey there,

A while back, we tried to update our old Nagios installation, but it failed so we decided to build a new VM from scratch and import the configs.

Following the instructions and ordering for importing existing configs, I received an error when importing the files in my services directory. The import tool is failing with the following error:

You must enter a proper host name. You can not use the characters: \~!$%^&*"'|<>?,()=

Here's an example configuration that is failing:

define service {
host_name dc01-cache-01,dc01-cache-02,dc01-cache-03,dc01-cache-04,dc01-cache-05,dc01-cache-06
service_description Apache Status - Cache
use Standard Check Settings,Critical to VictorOps [System Administrators - Email]
check_command check_apache!-a '-H localhost -p 8888 ' !!!!!!!
check_period xi_timeperiod_24x7
notification_period xi_timeperiod_24x7
_xiwizard linux-server
register 1
}

It seems like it's interpreting the comma separated list of hostname as a single host. I especially think this is true because the services.cfg that only have one host (ie localhost) all imported successfully. I have tried added a space, but it still is not working.

Re: Importing Configs into fresh Nagios XI Server

Posted: Wed Nov 02, 2016 7:23 pm
by rajasegar
You cannot use multiple hostnames in the following line

Code: Select all

  host_name dc01-cache-01,dc01-cache-02,dc01-cache-03,dc01-cache-04,dc01-cache-05,dc01-cache-06
You must use the config file prep tool which will create 6 service entries if I am not mistaken.
Personally I just import them with 1 entry and then add the next 5 in the UI.

Re: Importing Configs into fresh Nagios XI Server

Posted: Thu Nov 03, 2016 9:56 am
by bwallace
You are correct - multiple hosts comma separated will be interpreted as one long name by the config import /prep tool, and thanks for posting the solution you found. So is this is now resolved or did you have other questions on the topic?

Re: Importing Configs into fresh Nagios XI Server

Posted: Thu Nov 03, 2016 10:26 am
by philip.ianni
That actually wasn't the OP that posted the solution lol. I'm the OP.

The solutions makes sense, but I'm scared it won't work for our configuration structure.

We currently have a pretty big configuration that's composed on various services call about a dozen linux VM health checks (CPU, DISK, RAM etc). Each of these services has about 75 hostnames. When I go to run the config prep, it does not seem to work.

Here's my config file:

http://pastebin.com/VHwDkYxy

When I run something like:

/usr/local/nagiosxi/tools/xiprepimport.php /tmp/sample1 (sample1 is my cfg file)

It creates _multiple_hosts.cfg, sample1 in the directory. sample1 is completely empty file, _multiple_hosts.cfg is seemingly the exact same file I passed in. When I try to import _multiple_hosts.cfg, it fails with the same error.

Re: Importing Configs into fresh Nagios XI Server

Posted: Thu Nov 03, 2016 11:08 am
by gormank
Better to attach a hostgroup to the service rather than hosts. This solves multiple problems.

Re: Importing Configs into fresh Nagios XI Server

Posted: Thu Nov 03, 2016 4:14 pm
by avandemore
Are you following these instructions? Using The Config Import Prep Tool

Can you upload your sample1 file? Please PM to myself or other support personnel if privacy is an issue.