Tested with XI 5.5.5tail: cannot open '/usr/local/nagios/var/nagios.log\r' for reading: No such file or directory
EL6 looks fine
EL7 fails
Tested with XI 5.5.5tail: cannot open '/usr/local/nagios/var/nagios.log\r' for reading: No such file or directory
Code: Select all
nagios_log_file=$(cat /usr/local/nagios/etc/nagios.cfg | sed -n -e 's/^log_file=//p')
tail -n500 "$nagios_log_file" &> "/usr/local/nagiosxi/var/components/profile/$folder/nagios-logs/nagios.txt"Adding 'cat -A' shows all characters:[root@nagiosxi ~]# nagios_log_file=$(cat /usr/local/nagios/etc/nagios.cfg | sed -n -e 's/^log_file=//p')
[root@nagiosxi ~]# echo $nagios_log_file
/usr/local/nagios/var/nagios.log
Looking at all Nagios configuration files.. It's not just nagios.cfg that is affected:[root@nagiosxi ~]# echo $nagios_log_file |cat -A
/usr/local/nagios/var/nagios.log^M$
[root@nagiosxi ~]# tail -n500 "$nagios_log_file"
tail: cannot open â/usr/local/nagios/var/nagios.log\râ for reading: No such file or directory
Command dos2unix helped me getting rid of $ and ^M chars. You may lock this one, thanks![root@nagiosxi ~]# file /usr/local/nagios/etc/*.cfg |grep -v "ASCII text$"
/usr/local/nagios/etc/cgi.cfg: ASCII text, with CRLF line terminators
/usr/local/nagios/etc/commands.cfg: UTF-8 Unicode text, with very long lines
/usr/local/nagios/etc/contacts.cfg: UTF-8 Unicode text
/usr/local/nagios/etc/nagios.cfg: ASCII text, with very long lines, with CRLF line terminators
Great![email protected] wrote:Command dos2unix helped me getting rid of $ and ^M chars. You may lock this one, thanks!