Page 1 of 1
System Profile XI on EL7 fails on nagios.log
Posted: Fri Oct 19, 2018 6:23 am
The System Profile part responsible for collecting nagios.log on EL7 fails. These are the contents of the file:
tail: cannot open '/usr/local/nagios/var/nagios.log\r' for reading: No such file or directory
Tested with XI 5.5.5
EL6 looks fine
EL7 fails
Re: System Profile XI on EL7 fails on nagios.log
Posted: Fri Oct 19, 2018 1:27 pm
by cdienger
Check the
/usr/local/nagios/etc/nagios.cfg file for the
log_file= option. There may be an extra character at the end. The code that pulls the nagios.log looks like:
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"
Use
Configure > Core Config Manager > CCM Admin > Core Configs to modify view the nagios.cfg, and retype this line. Save and apply changes then test the profile generator again.
Re: System Profile XI on EL7 fails on nagios.log
Posted: Mon Oct 22, 2018 2:23 pm
Craig,
Retyping in CCM and saving does not solve the problem, but you set me on the right track by saying there might be extra characters! Here's what I found:
[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
Adding 'cat -A' shows all characters:
[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
Looking at all Nagios configuration files.. It's not just nagios.cfg that is affected:
[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
Command dos2unix helped me getting rid of
$ and
^M chars. You may lock this one, thanks!
Re: System Profile XI on EL7 fails on nagios.log
Posted: Mon Oct 22, 2018 3:10 pm
by scottwilkerson
[email protected] wrote:Command dos2unix helped me getting rid of $ and ^M chars. You may lock this one, thanks!
Great!
Locking