Different notification contents for different users

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
hhlodge
Posts: 206
Joined: Tue Mar 08, 2011 2:13 pm

Re: Different notification contents for different users

Post by hhlodge »

They've already modified their notifications, so that's been changed. Now I'm just trying to resole the newlines in the extended info, if we can have multiple lines there. And we upgraded to Enterprise today so I can have those additional features. :)
- Kyle
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Different notification contents for different users

Post by abrist »

hhlodge wrote:They've already modified their notifications, so that's been changed. Now I'm just trying to resole the newlines in the extended info, if we can have multiple lines there. And we upgraded to Enterprise today so I can have those additional features. :)

Just to verify, you have defined the long output for the user specific notification? Could you post screenshot of that portion of the notification template?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
hhlodge
Posts: 206
Joined: Tue Mar 08, 2011 2:13 pm

Re: Different notification contents for different users

Post by hhlodge »

If you meant "long" output, yes - we all see it now. As for notification template, I don't know what you want. I have service and contact templates. Is one of those what you want to see? Regardless, I still don't know how this affects the newlines in the expansion of $LONGSERVICEOUTPUT$.
- Kyle
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Different notification contents for different users

Post by scottwilkerson »

I believe what Andy is looking for is the Notification Messages template by clicking on the username (top right) and the Notification Messages
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
hhlodge
Posts: 206
Joined: Tue Mar 08, 2011 2:13 pm

Re: Different notification contents for different users

Post by hhlodge »

Here is mine. I Just see "\n" in the extended info as well.

Code: Select all

***** Nagios XI Alert *****

Notification Type: %type%

Service: %service%
Host: %hostalias%
Address: %hostaddress%
State: %servicestate%
Info: %serviceoutput%
Extended info: %longserviceoutput%
Date/Time: %datetime%

Author: %author%
Comment: %comments%
Notified: %notificationrecipients%

Respond: %responseurl%
Nagios URL: %xiserverurl%
- Kyle
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Different notification contents for different users

Post by abrist »

hmmm. Looks like the "\n" is not getting parsed as a newline in the notification component. We may have to use a crafty escaped shell command for the notification command as a bandaid until we can hunt down the fix:

Code: Select all

 --longserviceoutput="$$(echo "$LONGSERVICEOUTPUT$" | sed 's/\\n/<br \/>/g' )" 
I tested it, it works. It replaces "\n" with "<br />". Ugly, but it works.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
hhlodge
Posts: 206
Joined: Tue Mar 08, 2011 2:13 pm

Re: Different notification contents for different users

Post by hhlodge »

I'll take ugly any day - works great. Thank you!
- Kyle
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Different notification contents for different users

Post by abrist »

Great! Glad it works for you as well, though the escaping is definitely odd. Anything else or shall we lock this thread?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
hhlodge
Posts: 206
Joined: Tue Mar 08, 2011 2:13 pm

Re: Different notification contents for different users

Post by hhlodge »

All good - lock it. Good to know we can use shell commands in there.
- Kyle
Locked