Migrating from Nagios 3 to Nagios 4.3.2

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.
Locked
Lien Rag
Posts: 2
Joined: Tue Dec 12, 2017 11:48 am

Migrating from Nagios 3 to Nagios 4.3.2

Post by Lien Rag »

Hi.
As an intern I am tasked to migrate a Nagios 3 server on a defective ubuntu 14.04 VM to a new Nagios 4.3.2 server on a new debian stretch server.
I've finished the install of Nagios 4 and it works, but I monitor only localhost.

I'm trying the barbarian way (but safely, on a clone of the new VM) to see if there's an easier path than rewriting all (I'm entirely new at monitoring): I copied the old configuration directory in /usr/local/nagios/etc/my_old_conf and added

Code: Select all

cfg_dir=/usr/local/nagios/etc/my_old_conf
in /usr/local/nagios/etc/nagios.cfg and now Nagios won't restart.
From journalctl I get that there are deprecated commands in my old configuration's files.

I found on this forum which advise to do

Code: Select all

/usr/local/nagios/bin/nagios -vvv /usr/local/nagios/etc/nagios.cfg
which gives Invalid max_check_attempts value for host "srv_XXX" on line 1 of one (the first?) of the old config files.

I found this too which advise to sed the nagios.cfg file and I did it :

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
But if I understand correctly, it only corrects the nagios.cfg, and doesn't modify the config files in /usr/local/nagios/etc/my_old_conf ? So should I apply the same sed to all of them, or is there another method, or is there no easy way out of my situation?

I wasn't able to find good and easy to understand documentation on the migration I'm doing (basically, what is deprecated and by what should I replace it), are there some somewhere?
kyang

Re: Migrating from Nagios 3 to Nagios 4.3.2

Post by kyang »

The sed command just comments out the lines that are deprecated from Nagios 3.

Correct, it won't edit your nagios 3 config files.

When you ran this command :

Code: Select all

/usr/local/nagios/bin/nagios -vvv /usr/local/nagios/etc/nagios.cfg
Was that the only error message?

Most importantly, can you show us the config file for that host in which you are getting the error for?

Here is our upgrade process for Nagios Core.
https://assets.nagios.com/downloads/nag ... ading.html
Lien Rag
Posts: 2
Joined: Tue Dec 12, 2017 11:48 am

Re: Migrating from Nagios 3 to Nagios 4.3.2

Post by Lien Rag »

Thanks for replying.

One of the error was simply because the admin of the old server mixed up when he compressed the configuration files and replaced one of the .cfg by a .gzip to which he gave a .cfg extension - so obviously the verification failed.

The second was that "max_check_attempts" was not defined neither in the generic host nor in the define of each of the hosts, and apparently it is mandatory now.
Once this is fixed Nagios now works.

So, was I wrong in inferring that the configuration files architecture is different between Nagios 3 and Nagios 4?
Is there something I should do on the old configuration files?
The commands that are referred in the "upgrade process" were executed on a clean Nagios 4 server, and I copied the old server's files only after :

Code: Select all

./configure --with-command-group=nagcmd
make install-webconf
make install-init


Do the NRPE clients have to be updated too?
I have errors ("NRPE: Unable to read output ") on the check_lpstat on two of the 20 machines I monitor for test and don't understand why. The two very machines answer to check_nrpe without error, though.
kyang

Re: Migrating from Nagios 3 to Nagios 4.3.2

Post by kyang »

Sounds good.
For the .cfg file with extra extensions of gzip. You could just copy whats in there, and save it to a new .cfg file?
So, was I wrong in inferring that the configuration files architecture is different between Nagios 3 and Nagios 4?
Is there something I should do on the old configuration files?
The commands that are referred in the "upgrade process" were executed on a clean Nagios 4 server, and I copied the old server's files only after :
They should be identical if I think about it? Could you post one of your Nagios 3 cfg files? If you posted one, I would know for sure if your format is correct.

As for the NRPE issue. I would suggest if you could open a separate thread for that issue. That way we are not mixing two topics into one.

Otherwise, here is our kb article for NRPE: Unable to read output
https://support.nagios.com/kb/article/n ... t-620.html
Locked