Free Vars, macros, and inheritence

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
gwakem
Posts: 238
Joined: Mon Jan 23, 2012 2:02 pm
Location: Asheville, NC

Free Vars, macros, and inheritence

Post by gwakem »

Nagios XI 5.8.1
RHEL 7.7

Good morning! If I have a service template that is applied to a service, and the sevice template maps two free variables as such:
_kb $SERVICENOTESURL$
_alert_number $SERVICENOTIFICATIONNUMBER$

In the command I have appended --kbarticle="$_SERVICEKB$" --alertnumber="$_SERVICEALERT_NUMBER$"

The notes url field is populated within the specific service check. Are those macros able to be parsed via the free variables, and pulled in through the template to pick up the specific URL in the service and the notification number when sending an email alert? I was trying to use the free vars in the service template so I could simply populate the notes url field in the service check itself and have that URL end up in the emailed alert.

Currently with this setup, the alert is still coming across with the %kb% and %alertnumber% free vars in the emailed alert, like so:

Additional Info: WARNING - md5sum is not in list. Adding for you now.
Notifications sent: %alertnumber%
KB Article: %kbarticle%

Am I missing something, or is there a better way to handle this?
--
Griffin Wakem
User avatar
gwakem
Posts: 238
Joined: Mon Jan 23, 2012 2:02 pm
Location: Asheville, NC

Re: Free Vars, macros, and inheritence

Post by gwakem »

It looks like this may have been missed Friday, any ideas?
--
Griffin Wakem
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Free Vars, macros, and inheritence

Post by lmiltchev »

You don't need to use a template in this case. Simply append the following to the end of your notification command:

Code: Select all

--alertnumber="$SERVICENOTIFICATIONNUMBER$" --notesurl="$SERVICENOTESURL$"
Save and apply configuration. The notesurl will be "picked up" from each service if you have one added.

Also, make sure you have the following in the "Service Alert Message" field (Account > Notification Options > Notification Messages):

Code: Select all

Notifications sent: %alertnumber%
KB Article: %notesurl%
Click on "Update Settings".

You should see something like this in your emails (example):
Notifications sent: 0
KB Article: https://support.nagios.com/kb/
Let us know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
gwakem
Posts: 238
Joined: Mon Jan 23, 2012 2:02 pm
Location: Asheville, NC

Re: Free Vars, macros, and inheritence

Post by gwakem »

This did it. Thanks for your assistance! Lock away.
--
Griffin Wakem
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Free Vars, macros, and inheritence

Post by lmiltchev »

I am glad I could help! :D
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked