System Profile XI on EL7 fails on nagios.log

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
[email protected]
Posts: 68
Joined: Wed Dec 27, 2017 2:20 pm
Location: Nieuwegein, The Netherlands
Contact:

System Profile XI on EL7 fails on nagios.log

Post by [email protected] »

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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: System Profile XI on EL7 fails on nagios.log

Post by cdienger »

Check the /usr/local/nagios/etc/nagios.cfg file for thelog_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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
[email protected]
Posts: 68
Joined: Wed Dec 27, 2017 2:20 pm
Location: Nieuwegein, The Netherlands
Contact:

Re: System Profile XI on EL7 fails on nagios.log

Post by [email protected] »

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!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: System Profile XI on EL7 fails on nagios.log

Post by scottwilkerson »

[email protected] wrote:Command dos2unix helped me getting rid of $ and ^M chars. You may lock this one, thanks!
Great!

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked