Page 1 of 1

Notification formatting question, line breaks in email

Posted: Sat Sep 10, 2016 3:50 pm
by derekb
Hi there,

I'm trying to get the long service output from a check plugin into the email notification alerts.

This is what the plugin looks like after a proper check
Image

Normally, I get an email with the text in the red box via the %serviceoutput% macro.
I added %longserviceoutput% to my notification template, and I sort-of get the output in the blue box.

This is what I see:

Code: Select all

Info:
OK=18 WARNING=1 (threshold: 1) CRITICAL=1 (threshold: 1) UNKNOWN=0 (threshold: 1) services=// hosts=/Empire/
Services in WARNING:\n Empire - VoIP Dual-WAN Router = ether1-cpu - INTERNET Status\nServices in CRITICAL:\n Empire Internet Mikrotik = eth4-lan-maint Status
You will notice the \n line breaks in there. Is there any way to actually translate those into line returns to have the text formatted as shown in the blue box?

Re: Notification formatting question

Posted: Sat Sep 10, 2016 6:02 pm
by derekb
Just to add to this,
I found this post: https://support.nagios.com/forum/viewto ... 89&p=29429

Per Scott's suggestions here, I confirmed that "Allow HTML Tags in Host/Service Status" is enabled. And I write to wrap %longserviceoutput% with <pre> </pre> -- it just formatts the text differently in the email, \n is still there

Re: Notification formatting question, line breaks in email

Posted: Sat Sep 10, 2016 6:51 pm
by derekb

Re: Notification formatting question, line breaks in email

Posted: Mon Sep 12, 2016 12:52 pm
by mcapra
Thanks for sharing your solution! Is it alright if we lock this thread and mark the issue as resolved?

Re: Notification formatting question, line breaks in email

Posted: Mon Sep 12, 2016 12:57 pm
by derekb
mcapra wrote:Thanks for sharing your solution! Is it alright if we lock this thread and mark the issue as resolved?
Sure thing.