Page 1 of 1
Service Output is shown in a line
Posted: Sat Aug 24, 2019 8:35 am
by parisa
Hi
I have defined a service in Nagios xi that the service uses from a script (bash script), the service works correctly but output of the service is lines of a file that the script creates the file. I wanted the output to show in some lines but the output is shown as a line.
would you help me, how to show the service output line by line in "status information" part of monitoring?
I used \n and <br /> but it didn't work.
This is related to output of service:
Code: Select all
while read line
do
printf "%s<br />" "$line"
done < $Channels_Info
BR.
Parisa
Re: Service Output is shown in a line
Posted: Mon Aug 26, 2019 2:24 pm
by mbellerue
If you edit the file
/usr/local/nagios/etc/cgi.cfg you will see this setting,
Just change that from a 1 to a 0. You may need to restart Nagios for it to take effect. But once it's in effect, it will no longer escape HTML tags, so your <br /> should get you a new line.
Re: Service Output is shown in a line
Posted: Mon Aug 26, 2019 11:53 pm
by parisa
Hi @mbellerue
Thanks for your answer
I had changed value of "escape_html_tags" to 0 but I see the service output as attachment yet and html tag of <br /> is shown in output , is there any way to have better view?
BR.
Parisa
Re: Service Output is shown in a line
Posted: Tue Aug 27, 2019 9:40 am
by mbellerue
Did you also restart Nagios? That may be required for this change to take effect. Also, what version of Nagios XI is this?
Re: Service Output is shown in a line
Posted: Tue Aug 27, 2019 11:13 pm
by parisa
Yes, I restarted Nagios twice, the Nagios XI version is 5.6.5.
Re: Service Output is shown in a line
Posted: Wed Aug 28, 2019 10:20 am
by mbellerue
Ah, my apologies. That piece was just for Nagios Core. For Nagios XI, we need to enable HTML Tags. Head over to Admin -> System Settings -> General, and there will be a checkbox labeled "Allow HTML Tags in Host/Service Status." Just enable that, and head back over to Services and it should be processed properly.
Re: Service Output is shown in a line
Posted: Sat Aug 31, 2019 12:37 am
by parisa
@ mbellerue It's appreciated, it's solved.
I had searched for a option in cfg files of Nagios to active HTML tags, but only found "escape_html_tags" that it didn't work on XI. I didn't search on UI.
thanks for your help.
BE.
Parisa
Re: Service Output is shown in a line
Posted: Tue Sep 03, 2019 7:27 am
by scottwilkerson
parisa wrote:@ mbellerue It's appreciated, it's solved.
I had searched for a option in cfg files of Nagios to active HTML tags, but only found "escape_html_tags" that it didn't work on XI. I didn't search on UI.
thanks for your help.
BE.
Parisa
Great!
Locking