Notification formatting question, line breaks in email

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Notification formatting question, line breaks in email

Post 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?
You do not have the required permissions to view the files attached to this post.
Last edited by derekb on Sat Sep 10, 2016 6:10 pm, edited 1 time in total.
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Re: Notification formatting question

Post 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
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Re: Notification formatting question, line breaks in email

Post by derekb »

User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Notification formatting question, line breaks in email

Post by mcapra »

Thanks for sharing your solution! Is it alright if we lock this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
derekb
Posts: 177
Joined: Wed Jun 10, 2015 1:54 pm

Re: Notification formatting question, line breaks in email

Post 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.
Locked