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

Re: migration tools for Nagios Core

Post 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
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: migration tools for Nagios Core

Post 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
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:No such file or directory
Is nagios.cfg in this directory?

Code: Select all

ls -al 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 »

yes it is in the /usr/local/nagios/etc
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 »

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
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 »

still getting the same error message
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 »

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
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 »

/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.
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 »

now we need to see /usr/local/nagios/etc/hosts.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 »

hostsfile as requested
Attachments
host.cfg-updated.docx
(19.69 KiB) Downloaded 200 times
Locked