Page 1 of 1
Nagios Core to XI Configuration File Migration
Posted: Mon Mar 26, 2018 10:52 am
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
Re: Nagios Core to XI Configuration File Migration
Posted: Mon Mar 26, 2018 4:04 pm
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?
Re: Nagios Core to XI Configuration File Migration
Posted: Mon Mar 26, 2018 4:17 pm
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
Re: Nagios Core to XI Configuration File Migration
Posted: Mon Mar 26, 2018 4:31 pm
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.
Re: Nagios Core to XI Configuration File Migration
Posted: Tue Mar 27, 2018 8:32 am
by MikeMAN987
Thanks for the info Scott. Configuration file is PM'd.
Re: Nagios Core to XI Configuration File Migration
Posted: Tue Mar 27, 2018 8:47 am
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
Re: Nagios Core to XI Configuration File Migration
Posted: Tue Mar 27, 2018 9:03 am
by MikeMAN987
DOH! Thank you for that Scott. Perhaps the more migrations I perform, the less I remember.....
Thanks again!
Re: Nagios Core to XI Configuration File Migration
Posted: Tue Mar 27, 2018 9:10 am
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