Page 2 of 3

Re: migration tools for Nagios Core

Posted: Fri Oct 06, 2017 11:26 am
by DOkuwa
error message

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
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*use_embedded_perl_implicitly\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*sleep_time\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*p1_file\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*external_command_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*enable_embedded_perl\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*command_check_interval\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read nagios.cfg: No such file or directory

Re: migration tools for Nagios Core

Posted: Fri Oct 06, 2017 11:40 am
by DOkuwa
scott,

error message

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
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*use_embedded_perl_implicitly\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*sleep_time\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*p1_file\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*external_command_buffer_slots\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*enable_embedded_perl\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read -e: No such file or directory
sed: can't read s/^(\s*command_check_interval\s*=\s*)/# Line Commented out for Nagios v4 Compatibility\n#\1/g: No such file or directory
sed: can't read nagios.cfg: No such file or directory

Re: migration tools for Nagios Core

Posted: Fri Oct 06, 2017 1:24 pm
by scottwilkerson
DOkuwa wrote:No such file or directory
Is nagios.cfg in this directory?

Code: Select all

ls -al nagios.cfg

Re: migration tools for Nagios Core

Posted: Fri Oct 06, 2017 4:40 pm
by DOkuwa
yes it is in the /usr/local/nagios/etc

Re: migration tools for Nagios Core

Posted: Mon Oct 09, 2017 11:31 am
by scottwilkerson
lets change the command to

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' \ /usr/local/nagios/etc/nagios.cfg
copy the whole thing and paste command in terminal

Re: migration tools for Nagios Core

Posted: Tue Oct 10, 2017 9:49 am
by DOkuwa
still getting the same error message

Re: migration tools for Nagios Core

Posted: Tue Oct 10, 2017 9:57 am
by scottwilkerson
lets step back because this is taking more effort trying to run this script than necessary..

Can you verify your config

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If so, there is nothing else to do.

If you get an error about an invalid config option then we likely need to remove it from /usr/local/nagios/etc/nagios.cfg

Re: migration tools for Nagios Core

Posted: Tue Oct 10, 2017 10:20 am
by DOkuwa
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.3.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-08-24
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for host 'generic-host' (config file '/usr/local/nagios/etc/hosts.cfg', starting on line 88)
Error: Could not add object property in file '/usr/local/nagios/etc/hosts.cfg' on line 89.
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data definitions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

Re: migration tools for Nagios Core

Posted: Tue Oct 10, 2017 12:04 pm
by scottwilkerson
now we need to see /usr/local/nagios/etc/hosts.cfg

Re: migration tools for Nagios Core

Posted: Wed Oct 11, 2017 9:35 am
by DOkuwa
hostsfile as requested