Page 1 of 3

migration tools for Nagios Core

Posted: Thu Sep 21, 2017 9:29 am
by DOkuwa
I have a task here we have a very old Nagios Core 3.2.3
we want to migrate to the latest Nagios core 4.x or even 5
on a virtual  Unix (redhat or Ubuntu)
This is going to be a new installation 
Is there any Migration tool to migrate all the files from the old to the new without any hiccup

Re: migration tools for Nagios Core

Posted: Thu Sep 21, 2017 11:49 am
by scottwilkerson
The newest version is 4.3.4

For the most part everything should work with the same configuration files, except a few items need to be modified in your nagios.cfg which can be done with the following

make a backup of your existing nagios.cfg

Code: Select all

cd /usr/local/nagios/etc/
cp nagios.cfg nagios.cfg~pre-upgrade
run the following to comment out depreciated directives

Code: Select all

sed -i --regexp-extended -e "s/^(\s*check_result_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g" \
	-e 's/^(\s*use_embedded_perl_implicitly\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
	-e 's/^(\s*sleep_time\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
	-e 's/^(\s*p1_file\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
	-e 's/^(\s*external_command_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
	-e 's/^(\s*enable_embedded_perl\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
	-e 's/^(\s*command_check_interval\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \ nagios.cfg

Re: migration tools for Nagios Core

Posted: Fri Sep 22, 2017 3:10 am
by DOkuwa
I am migrating to a new server and performing a new install

Does this mean I have to configure everything all over again

Re: migration tools for Nagios Core

Posted: Fri Sep 22, 2017 8:29 am
by scottwilkerson
DOkuwa wrote:I am migrating to a new server and performing a new install

Does this mean I have to configure everything all over again
No, you can use the same configuration files you had before, except you will need to run the above on the nagios.cfg because there are a few directives that are deprecated.

Re: migration tools for Nagios Core

Posted: Fri Sep 22, 2017 10:27 am
by DOkuwa
Thanks
But this means that we have to copy across all the .cfg from the /usr/local/Nagios/etc(old server)to the new server

Re: migration tools for Nagios Core

Posted: Fri Sep 22, 2017 11:06 am
by dwhitfield
That's correct. I would suggest using a tool like Filezilla to help facilitate this.

Re: migration tools for Nagios Core

Posted: Thu Sep 28, 2017 6:17 am
by DOkuwa
What is the purpose of this
sed -i --regexp-extended -e "s/^(\s*check_result_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g" \
   -e 's/^(\s*use_embedded_perl_implicitly\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*sleep_time\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*p1_file\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*external_command_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*enable_embedded_perl\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*command_check_interval\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \ nagios.cfg

Re: migration tools for Nagios Core

Posted: Thu Sep 28, 2017 11:17 am
by scottwilkerson
This just comments all the commands from your nagios.cfg that are deprecated in in Nagios 4

Re: migration tools for Nagios Core

Posted: Fri Oct 06, 2017 9:06 am
by DOkuwa
@scottwilkerson
just looking at the Nagios.cfg
does this mean that I run each command on each line e.g

sed -i --regexp-extended -e "s/^(\s*check_result_buffer_slots\s*=\s*)/ nagios.cfg

please tell me

Re: migration tools for Nagios Core

Posted: Fri Oct 06, 2017 10:52 am
by scottwilkerson
This is one command that you can copy and paste into a terminal

Code: Select all

sed -i --regexp-extended -e "s/^(\s*check_result_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g" \
   -e 's/^(\s*use_embedded_perl_implicitly\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*sleep_time\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*p1_file\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*external_command_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*enable_embedded_perl\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \
   -e 's/^(\s*command_check_interval\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g' \ nagios.cfg
The only caveat is that you should be in the directory that contains your nagios.cfg