Email Notifications containing Macros - Acknowledgement

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Lateralus
Posts: 10
Joined: Sun Dec 09, 2012 1:30 pm

Email Notifications containing Macros - Acknowledgement

Post by Lateralus »

Hi guys,

I'm using the latest version of Nagios, and have come up with a problem from the email notifications' Macros.

When Nagios sends a notification email of ACKNOWLEDGEMENT,I added $HOSTACKAUTHOR$ and $HOSTACKCOMMENT$ to the command.
My intention was obviously to display the username acknowledging the problem, and his comments.

I've accomplished that.

However, these 2 macros also appear with WARNING and CRITICAL notifications, and this is exactly what cannot happen according to the definition of these macros:
"This macro is only valid in notifications where the $NOTIFICATIONTYPE$ macro is set to "ACKNOWLEDGEMENT".

So service alerts look like this:

Notification Type: RECOVERY
Host: us-terminal
Address: us-terminal
State: OK
Author:
Comments:


Is this a bug in Nagios?
Those macros should automatically operate with acknowledgements only, but they do regardless of the notification type!

Have any of you ever encountered such a thing?

Thanks in advance,
Ido
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Email Notifications containing Macros - Acknowledgement

Post by jsmurphy »

They are operating exactly as I would expect based on the information you have provided. When it's an acknowledgement you see the username and comment and when it's an alert you see just a blank space as you demonstrated... this is the expected behaviour.

Maybe I'm confused, but you say they are operating, yet there is no output where the macro would be...
Lateralus
Posts: 10
Joined: Sun Dec 09, 2012 1:30 pm

Re: Email Notifications containing Macros - Acknowledgement

Post by Lateralus »

jsmurphy wrote:They are operating exactly as I would expect based on the information you have provided. When it's an acknowledgement you see the username and comment and when it's an alert you see just a blank space as you demonstrated... this is the expected behaviour.

Maybe I'm confused, but you say they are operating, yet there is no output where the macro would be...

Hi,

Thanks for answering.

Well, what I would expect, is to not have these macros at all when a WARNING or CRITICAL email arrives, since there is no possible output.

What I'm trying to achieve here is to have these 2 lines (ACK by and Comments) appear only in ACK messages.

For any other notification but ACK - I have redundant 2 lines in every email.

Is that possible to avoid that?

Thanks in advance,
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Email Notifications containing Macros - Acknowledgement

Post by jsmurphy »

The words "Author:" and "Comments:" are not related to the macro in any way whatsoever they are just static text some one has put there, the macros aren't there at all. The easiest way to get the functionality you want would be to remove those static words...

a service would display like this:
Notification Type: RECOVERY
Host: us-terminal
Address: us-terminal
State: OK



an acknowledgement would display like:
Notification Type: ACKNOWLEDGEMENT
Host: us-terminal
Address: us-terminal
State: OK
user1
I've acknowledged a thing.

Does that look more like what you are after?
Lateralus
Posts: 10
Joined: Sun Dec 09, 2012 1:30 pm

Re: Email Notifications containing Macros - Acknowledgement

Post by Lateralus »

jsmurphy wrote:The words "Author:" and "Comments:" are not related to the macro in any way whatsoever they are just static text some one has put there, the macros aren't there at all. The easiest way to get the functionality you want would be to remove those static words...

a service would display like this:
Notification Type: RECOVERY
Host: us-terminal
Address: us-terminal
State: OK



an acknowledgement would display like:
Notification Type: ACKNOWLEDGEMENT
Host: us-terminal
Address: us-terminal
State: OK
user1
I've acknowledged a thing.

Does that look more like what you are after?
Oh!!! Now I got it.... Thank you very much friend, for opening my eyes to the solution!

Cheers!
Locked