Nagios Core to XI Configuration File Migration

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MikeMAN987
Posts: 58
Joined: Fri Sep 29, 2017 9:57 am

Nagios Core to XI Configuration File Migration

Post by MikeMAN987 »

Hello,

We are in the process of migrating from Nagios Core to XI, and wanted to confirm that the following line is a requirement for migration.

Create a temporary directory for holding the converted configuration files. This directory must be located
beneath the /usr/local/nagios/etc directory structure. Example:
mkdir /usr/local/nagios/etc/cfgprep

I thought I remember it working on other directories in other migrations I have completed (I don't have SUDO on this box right now) such as staging in a home directory, but I could be wrong. In the current state, when I run config prep on the old files in my home directory it never completes and the configuration files just get larger and larger in size until I cancel the job. That said, thank you for confirming or denying my suspicions!

Regards,
Mike
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios Core to XI Configuration File Migration

Post by tgriep »

The reason the files have to be beneath the /usr/local/nagios/etc directory structure is when you get to the step to import the files, the Nagios XI GUI does not have access to other folders.

You can copy the original files to another folder and prep them there but when it comes time to do the import in the GUI, they have to be in the /usr/local/nagios/etc directory structure.

The issue of the conversion not finishing and the file that grows.
What it the name of the file?
How many Hosts and Service checks are you trying to convert?

Can you post a few entries from the bottom of the file to the post so we can see it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
MikeMAN987
Posts: 58
Joined: Fri Sep 29, 2017 9:57 am

Re: Nagios Core to XI Configuration File Migration

Post by MikeMAN987 »

Thanks for confirming what I understood in the past (normally i run these migrations in my own home directory to test and pass to a SUDO'er to import/create the directory structure.

File Information Before (note Size appx 6KB):
5657 Mar 22 15:31 commands.cfg

Command Being Run (does not complete):
php /usr/local/nagiosxi/tools/xiprepimport.php /myhomedirectory/originalconfigs/commands.cfg

File Information After 1 minute (not completed, note size appx 500MB):
517533947 Mar 26 16:14 commands.cfg

Contents of end of File (28 command entires in complete file):

define command{
command_name check_mail_procs
command_line $USER1$/check_procs -u $ARG1$
}

define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

define command {
command_name check_ll
command_line /usr/local/nagios/libexec/check_ll
}

define command {
command_name check_qall
command_line /usr/local/nagios/libexec/check_qall
}

define command{
command_name check_mq
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mq -a $ARG1$ $ARG2$ $ARG3$
}

define command {
command_name check_swap
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_swap -a $ARG1$ $ARG2$
}

define command{
command_name check_cups_queue
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cups_queue -a $ARG1$ $ARG2$ $ARG3$
}

define command{
command_name check_clam_daemon
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_tcp -a $ARG1$
}

We will be migrating approximately 500 hosts and 6500 checks. I was under the impression at this point, the amount/count of hosts wouldnt be coming into play(as I havent moved towards hosts/service imports).

Thank you for the information thus far!

Regards,
Mike
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Core to XI Configuration File Migration

Post by scottwilkerson »

One thing I will point out is that if there is one file that likely doesn't need to be run through the xiprepimport.php it is the commands.cfg

Doing so shouldn't cause your issue, but you may be able to skip it and import directly.

The only think I can think is that there is some special chars, or comments or lin endings that are messing it up.

If you would like, you can PM me your commands.cfg and I can test it from here.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
MikeMAN987
Posts: 58
Joined: Fri Sep 29, 2017 9:57 am

Re: Nagios Core to XI Configuration File Migration

Post by MikeMAN987 »

Thanks for the info Scott. Configuration file is PM'd.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Core to XI Configuration File Migration

Post by scottwilkerson »

Ok, here is what I believe the problem is, as I ran into it testing your config

your pwd CANNOT be the directory that contains the originalconfigs

for example, if you are running this command

Code: Select all

php /usr/local/nagiosxi/tools/xiprepimport.php /myhomedirectory/originalconfigs/commands.cfg
you CANNOT be in /myhomedirectory/originalconfigs

or you end up with a never ending cycle, because it is writing the new file to the directory you are cd'd into.

When I did it from another directory, it worked perfectly
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
MikeMAN987
Posts: 58
Joined: Fri Sep 29, 2017 9:57 am

Re: Nagios Core to XI Configuration File Migration

Post by MikeMAN987 »

DOH! Thank you for that Scott. Perhaps the more migrations I perform, the less I remember.....

Thanks again!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Core to XI Configuration File Migration

Post by scottwilkerson »

MikeMAN987 wrote:DOH! Thank you for that Scott. Perhaps the more migrations I perform, the less I remember.....

Thanks again!
Glad it is resolved, locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked