Page 1 of 1

nagiosxi migration tool fails.

Posted: Wed Sep 01, 2021 2:43 pm
by benhank
Hello guys . I have two servers, both are running Nagios XI 5.8.5.
Server one has 2,000+ Hosts and 10000+ services.
Server 2 is a fresh install with zero hosts and services.
Both are running the same software and are on the same OS version.
I am trying to use the server migration tool in Admin\ Monitoring Config\migrate server
Here is a screenshot of the error I get:
Capture.PNG

Code: Select all

lvnagiost02 ~]$  tail -f /usr/local/nagiosxi/var/cmdsubsys.log
  File "nagios_unbundler.py", line 388, in import_object_cfg
    with open('nagiosbundle-config/services/'+file_name+'.cfg', 'a') as service_file:
IOError: [Errno 2] No such file or directory: 'nagiosbundle-config/services/nagiosbundle-config/migrated-services.cfg'
Error: Configs could not be processed.OUTPUT=Error: Configs could not be processed.
RETURNCODE=1
.......................................
PROCESSED 1 COMMANDS
.............................................................
PROCESSED 0 COMMANDS
........................PROCESSING COMMAND ID 11...
PROCESS COMMAND: CMD=1180, DATA={"address":"172.22.3.176","username":"bhanks","password":"MDM4N2ZjOWQ1ZTg0YzAxZHA2MVpzZmkxNlFiSGY5ZjdlUWxobEE9PQ==","overwrite":1,"clear":0,"nagios_cfg":""}
CMDLINE=sudo /usr/bin/php /usr/local/nagiosxi/scripts/migrate/migrate.php -a '172.22.3.176' -u 'bhanks' -p 'MDM4N2ZjOWQ1ZTg0YzAxZHA2MVpzZmkxNlFiSGY5ZjdlUWxobEE9PQ==' -e -o
No entry for terminal type "unknown";
using dumb terminal settings.
PHP Notice:  Array to string conversion in /usr/local/nagiosxi/scripts/migrate/migrate.php on line 146

Array
0
Traceback (most recent call last):
  File "nagios_unbundler.py", line 451, in <module>
    main()
  File "nagios_unbundler.py", line 446, in main
    import_object_cfg(nagiosbundle_json['cfg_file'], nagiosbundle_json['cfg_dir'], options.ignore_configuration, options.overwrite_configuration, nagiosbundle_json['is_nagiosxi'])
  File "nagios_unbundler.py", line 388, in import_object_cfg
    with open('nagiosbundle-config/services/'+file_name+'.cfg', 'a') as service_file:
IOError: [Errno 2] No such file or directory: 'nagiosbundle-config/services/nagiosbundle-config/migrated-services.cfg'
Error: Configs could not be processed.OUTPUT=Error: Configs could not be processed.

Re: nagiosxi migration tool fails.

Posted: Thu Sep 02, 2021 3:14 pm
by pbroste
Hello @benhank

Thanks for reaching out, I ran through the test on my test environment and was able to get things to migrate over.

Some things to check:
  • Firewall
  • Security applications like Selinux (verify disabled)
  • Able to ssh via root
My favorite part of the migration tool is the statement that it will try; "The tool will try to reach out to the Nagios Core server, collect the configuration data, and configure Nagios XI"

The other options to migrate are provided in this support article:

https://support.nagios.com/kb/article/migrating-nagios-xi-to-a-different-server-892.html

or you bring in the database and import that:

Code: Select all

mysql -uroot -pnagiosxi nagiosql < thenagiosql.sql
  • After that you would then want to headover to the Nagios XI web console > Core Configuration Manager > Config File Management > Delete > Write > Apply Configuration. Bounce the nagios.services and verify.
Please let me know if you have further questions,
Perry

Re: nagiosxi migration tool fails.

Posted: Tue Sep 07, 2021 11:58 am
by benhank
I would like to use the server migration tool and not the workarounds.

I have verified that selinux and firewalld are disabled on both servers.
root is disabled on both servers but I have an account that can ssh via sudo.

Re: nagiosxi migration tool fails.

Posted: Tue Sep 07, 2021 5:01 pm
by pbroste
Hello @benhank

Sounds good, you can find the support instructions here on how to go about the server migrations.
Please let us know if you have further questions.

Thanks,
Perry

Re: nagiosxi migration tool fails.

Posted: Thu Sep 09, 2021 11:11 am
by benhank
How do I get this to work from the web GUI?
tempsnip.png

Re: nagiosxi migration tool fails.

Posted: Thu Sep 09, 2021 5:07 pm
by pbroste
Hello @benhank

There appears to be some prerequisites for the 'Migration Tool' to function, it uses Python3 found in this article see Prerequistities and Important Notes

https://support.nagios.com/kb/article/automatic-nagios-core-migration-to-nagios-xi-878.html
Prerequisites
Python must be installed on any Nagios Core systems you wish to migrate. Install python if necessary.
Example:
dnf install python3
If migrating Nagios Core from an EL-8 system to Nagios XI hosted on EL-7, a python file called ‘python’ must exist in /usr/bin/ on the Nagios Core system. One method of accomplishing this is to copy the EL-8 version of python (python3, python2, etc…).
Example:
ln -s /usr/bin/python3 /usr/bin/python
....
....

Important Notes
The current version of the Nagios Core migration automation feature will move PLUGINS and OBJECT CONFIGS only. We will be adding more features/functionality as we build out future versions. Currently, performance data is not migrated.
Migration replaces some of the nagios.cfg directives, but not all. Specifically, it changes (uses Core's value for) all of the directives in the "#UNMODIFIED" section of XI's .cfg that aren't file/directory paths.
A successful migration always finishes by applying configuration and creating a configuration snapshot. Therefore, the migration can always be reverted by restoring the old configuration snapshot.
Migration will only overwrite existing configuration if you have checked the "Overwrite duplicates..." in the GUI interface. Otherwise, the migration will import any object configurations that do not currently exist in the CCM.
Plugin import may not work properly under the following conditions:

If the plugin has dependencies, the import process does not automatically install those dependencies.
If the plugin is compiled on a different distribution/using nonstandard dependencies, it will need to be re-compiled on the current system.
If the plugin was written for a distribution with different default scripting environments (for shell, python, perl, etc), the other scripting environment may need to be installed, or the plugin may need to be changed to work with the new scripting environment.
Thanks,
Perry

Re: nagiosxi migration tool fails.

Posted: Fri Sep 10, 2021 10:24 am
by benhank
I see now. ok .
We are running the latest version of python as both machines were installed on a clean version of the latest Centos 7.
I normally don't push like I did this time, and would have happily applied the workarounds you suggested.
The problem for me is that this is part of a migration testing process.
We needed to see how the migration tool works. I apologize for being pushy.

Re: nagiosxi migration tool fails.

Posted: Fri Sep 10, 2021 12:19 pm
by pbroste
Hello @benhank,

Sounds good, let us know how things work, and if you need further assistance on this.

Thanks,
Perry