Plugins from /usr/local/nagios/libexec path not restored
Posted: Wed Dec 01, 2021 5:10 pm
Hi,
I've recently transitioned into a role where I'm assisting with migrating a production Nagios XI instance on RHEL 6 (XI 5.6.14) to a new box on RHEL 8 (5.8.7).
As I understand it, we need to install the same version of Nagios XI on the destination system we're migrating to that we're currently using to run it on the source/original system. Unfortunately, as I understand it Nagios XI 5.6.14 won't work on RHEL 8 and a direct upgrade to the latest XI version on the RHEL 6 instance won't work either.
I have a RHEL 7 box at my disposal that I'm using as an intermediate box to restore a 5.6.14 backup to so that I can perform an in-place Nagios XI upgrade to 5.8.7 before I create another backup and then restore to the intended replacement production RHEL 8 system. It's a bit of a hop, but it seems like it will work.
I restored the backup (created on the RHEL 6 box) on the RHEL 7 box today, but initial testing revealed that not all of our plugins (located in the /usr/local/nagios/libexec path on the RHEL 6 box) were restored on the RHEL 7 system.
This text was shown during the restore attempt:
This is the relevant/important text:
It did not however restore our text/script-based (Perl, Bash, etc.) plugins which are not compiled.
I tracked this down to this section of the restore_xi.sh script:
Specifically, this line:
If I modify the wildcard to just one asterisk then all plugins are restored.
I have to admit, I don't fully understand the intent behind the *.* wildcard, but I can reproduce the results with a ls call, so the wildcard pattern is having the same effect for ls as it is for the tar extraction command.
Regarding plugins that are not copied over, one example is a plugin named k_auPanopto (no file extension).
After reviewing the restore_xi.sh script I think that would be fine just manually restoring non-binary plugins from the /usr/local/nagios/libexec/ path on the source system to the intermediate (RHEL 7) and final (RHEL 8) boxes, but I wanted to reach out and make sure there wasn't other content (aside from Apache configs) that is not being restored by this workflow:
1) sudo /usr/local/nagiosxi/scripts/restore_xi.sh /store/backups/nagiosxi/1638309772.tar.gz
2) cd /tmp/
3) wget https://assets.nagios.com/downloads/nag ... _repair.sh
4) chmod +x restore_repair.sh
5) ./restore_repair.sh
I'm of the impression that either there is a bug in one of:
- the output from restore_xi.sh script (it implies that only compiled plugins are skipped)
- the restore_xi.sh script extraction syntax (the tar wildcard) which skips restoration of numerous non-binary plugins
Thanks in advance for your help!
I've recently transitioned into a role where I'm assisting with migrating a production Nagios XI instance on RHEL 6 (XI 5.6.14) to a new box on RHEL 8 (5.8.7).
As I understand it, we need to install the same version of Nagios XI on the destination system we're migrating to that we're currently using to run it on the source/original system. Unfortunately, as I understand it Nagios XI 5.6.14 won't work on RHEL 8 and a direct upgrade to the latest XI version on the RHEL 6 instance won't work either.
I have a RHEL 7 box at my disposal that I'm using as an intermediate box to restore a 5.6.14 backup to so that I can perform an in-place Nagios XI upgrade to 5.8.7 before I create another backup and then restore to the intended replacement production RHEL 8 system. It's a bit of a hop, but it seems like it will work.
I restored the backup (created on the RHEL 6 box) on the RHEL 7 box today, but initial testing revealed that not all of our plugins (located in the /usr/local/nagios/libexec path on the RHEL 6 box) were restored on the RHEL 7 system.
This text was shown during the restore attempt:
Code: Select all
WARNING: you are trying to restore a el6 backup on a el7 system
Compiled plugins and other binaries as well as httpd configurations
will NOT be restored.
You will need to re-download the Nagios XI tarball, and re-install
the subcomponents for this system. More info here:
https://assets.nagios.com/downloads/nagiosxi/docs/Backing-Up-And-Restoring-Nagios-XI.pdf
Are you sure you want to continue? [y/N] Y
TS=1638378587
Extracting backup to /store/backups/nagiosxi/1638378587-restore...
In /store/backups/nagiosxi/1638378587-restore/1638309772...
Backup files look okay. Preparing to restore...
Shutting down services...
Restoring directories to /...
Restoring Nagios Core...
Restoring Nagios XI...
Restoring NRDP backups...
Restoring MRTG...
Restoring SNMP configuration files...
Restoring SNMP MIBs...
Restoring Nagvis backups...
Restoring nagios home dir...
Restoring MySQL databases...
Restoring Nagios XI MySQL database...
Restarting database servers...
Restoring Apache cronjobs...
Restoring logrotate config files...
Skipping Apache config files restoration
===============
RESTORE COMPLETE
===============
Reading the Backing-Up-And-Restoring-Nagios-XI.pdf document, I found mention of the https://assets.nagios.com/downloads/nag ... _repair.sh script and I used that in order to restore missing plugins/compiled binaries.Compiled plugins and other binaries as well as httpd configurations
will NOT be restored.
It did not however restore our text/script-based (Perl, Bash, etc.) plugins which are not compiled.
I tracked this down to this section of the restore_xi.sh script:
Code: Select all
# Nagios Core
echo "Restoring Nagios Core..."
if [ "$arch" == "$backuparch" ] && [ $SPECIAL_BACKUP -eq 0 ]; then
rm -rf /usr/local/nagios
cd $rootdir && tar xzf $backupdir/nagios.tar.gz
else
rm -rf /usr/local/nagios/etc /usr/local/nagios/share /usr/local/nagios/var
cd $rootdir && tar --exclude="usr/local/nagios/bin" --exclude="usr/local/nagios/sbin" --exclude="usr/local/nagios/libexec" -xzf $backupdir/nagios.tar.gz
cd $rootdir && tar --wildcards 'usr/local/nagios/libexec/*.*' -xzf $backupdir/nagios.tar.gz
fi
Code: Select all
cd $rootdir && tar --wildcards 'usr/local/nagios/libexec/*.*' -xzf $backupdir/nagios.tar.gz
I have to admit, I don't fully understand the intent behind the *.* wildcard, but I can reproduce the results with a ls call, so the wildcard pattern is having the same effect for ls as it is for the tar extraction command.
Regarding plugins that are not copied over, one example is a plugin named k_auPanopto (no file extension).
After reviewing the restore_xi.sh script I think that would be fine just manually restoring non-binary plugins from the /usr/local/nagios/libexec/ path on the source system to the intermediate (RHEL 7) and final (RHEL 8) boxes, but I wanted to reach out and make sure there wasn't other content (aside from Apache configs) that is not being restored by this workflow:
1) sudo /usr/local/nagiosxi/scripts/restore_xi.sh /store/backups/nagiosxi/1638309772.tar.gz
2) cd /tmp/
3) wget https://assets.nagios.com/downloads/nag ... _repair.sh
4) chmod +x restore_repair.sh
5) ./restore_repair.sh
I'm of the impression that either there is a bug in one of:
- the output from restore_xi.sh script (it implies that only compiled plugins are skipped)
- the restore_xi.sh script extraction syntax (the tar wildcard) which skips restoration of numerous non-binary plugins
Thanks in advance for your help!