Importing Configs into fresh Nagios XI Server

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
philip.ianni
Posts: 29
Joined: Tue Dec 29, 2015 12:35 pm

Importing Configs into fresh Nagios XI Server

Post 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.
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Re: Importing Configs into fresh Nagios XI Server

Post 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.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Importing Configs into fresh Nagios XI Server

Post 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?
Be sure to check out the Knowledgebase for helpful articles and solutions!
philip.ianni
Posts: 29
Joined: Tue Dec 29, 2015 12:35 pm

Re: Importing Configs into fresh Nagios XI Server

Post 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.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Importing Configs into fresh Nagios XI Server

Post by gormank »

Better to attach a hostgroup to the service rather than hosts. This solves multiple problems.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Importing Configs into fresh Nagios XI Server

Post 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.
Previous Nagios employee
Locked