migration tools for Nagios Core

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

migration tools for Nagios Core

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: migration tools for Nagios Core

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: migration tools for Nagios Core

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: migration tools for Nagios Core

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: migration tools for Nagios Core

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: migration tools for Nagios Core

Post by dwhitfield »

That's correct. I would suggest using a tool like Filezilla to help facilitate this.
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: migration tools for Nagios Core

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: migration tools for Nagios Core

Post by scottwilkerson »

This just comments all the commands from your nagios.cfg that are deprecated in in Nagios 4
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: migration tools for Nagios Core

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: migration tools for Nagios Core

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked