Not all Standard Macros not working in Email Notifications:
Service Alert Message that I have:
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info:
%serviceoutput%
Date/Time: %datetime%
Confluence Documentation/Resolution:
%servicenotesurl%
%servicenotes%
Unfortunately these are being passed as plaintext and not converted:
Confluence Documentation/Resolution:
%servicenotesurl%
%servicenotes%
I have both Notes URL and Notes filled up under the failing Service. What am I missing?
Not all Standard Macros working in Email Notifications
Re: Not all Standard Macros working in Email Notifications
Did you follow the steps, outlined in this document?
https://assets.nagios.com/downloads/nag ... iables.pdf
These macros work fine for me. In my notification handler command I have:
In my notification messages, I have:
In the actual email, I get:
so the macros do resolve...
Can you show us your notification command?
https://assets.nagios.com/downloads/nag ... iables.pdf
These macros work fine for me. In my notification handler command I have:
Code: Select all
--notes="$SERVICENOTES$" --notesurl="$SERVICENOTESURL$"Code: Select all
%notes%
%notesurl%Code: Select all
This is a test note.
https://www.nagios.comCan you show us your notification command?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Not all Standard Macros working in Email Notifications
Hello, lmiltchev
I'm not using custom macros - i want to use the default fields that are under Service -> Misc Settings -> Fields: Notes, Notes URL
Edit: The ones that you can see in my original notification are from here: https://assets.nagios.com/downloads/nag ... olist.html
I'm not using custom macros - i want to use the default fields that are under Service -> Misc Settings -> Fields: Notes, Notes URL
Edit: The ones that you can see in my original notification are from here: https://assets.nagios.com/downloads/nag ... olist.html
You do not have the required permissions to view the files attached to this post.
Re: Not all Standard Macros working in Email Notifications
That's because not all of them are included in the default Nagios XI notification handler.justassi wrote:Not all Standard Macros not working in Email Notifications
Fortunately, the documentation provided by @lmiltchev solves this by augmenting that default notification handler with additional information. It's not only using custom macros; It's also using those same core macros you referenced and passing them in to the default Nagios XI notification handler script, which will sub out the %var% values in the email template with the provided arguments in a generic fashion. In other words, those args are directly referenced when the templates %var% values are evaluated.
The documentation is not limited in scope to only custom variables/macros. @lmiltchev's solution is the "cliff notes" version of that documentation for the specific thing you're attempting to do.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Not all Standard Macros working in Email Notifications
@mcapra, thanks for the clarification!
@justassi
Make sure the %var% names in your notifications messages are the same as the ones in your notification command (as per our document).
Example:
@justassi
Neither am I. I was giving you an example with a similar setup. See below:I'm not using custom macros - i want to use the default fields that are under Service -> Misc Settings -> Fields: Notes, Notes URL
Make sure the %var% names in your notifications messages are the same as the ones in your notification command (as per our document).
Example:
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Not all Standard Macros working in Email Notifications
Hello lmiltchev,
Thank you for your help.
When I add the suggested variables to the notification template:
Alert Notes: %notes%
Alert Documentation: %notesurl%
In my notification Service Alert Message I receive them exactly the same (as you see in the screenshot, not translated to the fields that are filled in the service configuration).
Am I forgetting to enable something?
Thank you for your help.
When I add the suggested variables to the notification template:
Alert Notes: %notes%
Alert Documentation: %notesurl%
In my notification Service Alert Message I receive them exactly the same (as you see in the screenshot, not translated to the fields that are filled in the service configuration).
Am I forgetting to enable something?
You do not have the required permissions to view the files attached to this post.
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Not all Standard Macros working in Email Notifications
@justassi, Did you append the following arguments to the end of the "xi_service_notification_handler" command?
Lastly, please check what notification commands are used by the contact? If you open the contact in the CCM and go to the Alert Settings tab, you should see notification commands assigned under "Manage Host Notification Commands" and "Manage Service Notification Commands".
Did you restart the Core Configuration Manager afterward?--notes="$SERVICENOTES$" --notesurl="$SERVICENOTESURL$"
Lastly, please check what notification commands are used by the contact? If you open the contact in the CCM and go to the Alert Settings tab, you should see notification commands assigned under "Manage Host Notification Commands" and "Manage Service Notification Commands".
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Not all Standard Macros working in Email Notifications
Thank you everyone for your help! It's working like a charm now after adding additional information to the "xi_service_notification_handler" command.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Not all Standard Macros working in Email Notifications
Excellent! Glad it is resolved!justassi wrote:Thank you everyone for your help! It's working like a charm now after adding additional information to the "xi_service_notification_handler" command.
Locking thread