Page 1 of 1

send_nrdp.sh and newline in output

Posted: Wed Sep 30, 2020 5:14 am
by giponino
Hi, I'm trying to use send_nrdp.sh to send passive result check to NagiosXI, the problem is that I need to insert a text with multiple line into the output,
i.e.
/usr/local/nrdp/clients/send_nrdp.sh -u http://ip/nrdp/ -t token -H hostname -s "Alarm" -S 1 -o "text \n text \n text"

But in both NagiosXI UI and in alarm email there's only "text"

I also tried "-o "text \\n text \\n text"" but the result is the same. How I can do to see text with multiple lines in Nagios UI and alarm email?

Thank you

Re: send_nrdp.sh and newline in output

Posted: Wed Sep 30, 2020 12:38 pm
by mbellerue
What happens if you put <br /> in place of the \n?

You will want to also enable HTML tags in Host/Service status. To do this got to Admin -> System Config -> System Settings -> Check the "Allow HTML Tags in Host/Service Status."

Re: send_nrdp.sh and newline in output

Posted: Thu Oct 01, 2020 9:17 am
by giponino
That's fantastic, enabling HTML in Admin config and using <br /> instead of \n now in Nagios XI UI I can see all the string in many rows.
But in the email sent the <br /> are not interpreted, is it possible to solve also this?

Service: Alarm
Host: Host
Address: IP
State: WARNING
Info:
textbr /textbr /text
Date/Time: 01/10/2020 15:10:22

Re: send_nrdp.sh and newline in output

Posted: Fri Oct 02, 2020 9:58 am
by benjaminsmith
Hi @giponino,

It looks like the <> are being stripped from the output message in the notification. This information is sent to the notification handlers using the available marcros in Nagios Core. Try testing again but remove those characters in the following option in the main nagios configuration file /usr/local/nagios/etc/nagios.cfg.
Format: illegal_macro_output_chars=<chars...>
Example: illegal_macro_output_chars=`~$^&"|'<>
This option allows you to specify illegal characters that should be stripped from macros before being used in notifications, event handlers, and other commands. This DOES NOT affect macros used in service or host check commands. You can choose to not strip out the characters shown in the example above, but I recommend you do not do this. Some of these characters are interpreted by the shell (i.e. the backtick) and can lead to security problems. The following macros are stripped of the characters you specify:
https://assets.nagios.com/downloads/nag ... tput_chars

Be sure to restart Nagios Core after making any changes.

Code: Select all

systemctl restart nagios
Regards,
Benjamin