Page 1 of 1

Free Variables not displaying in service alert messages

Posted: Tue Jan 29, 2019 11:42 am
by mbeebe
Hello,

I'm trying to accomplish something very simple: in our emailed service alerts, I want to add a link to our knowledgebase.

I followed the instructions for setting up custom service macros in this document: https://assets.nagios.com/downloads/nag ... iables.pdf

I have the following definitions:

In the service itself, I have a Free Variable defined as _kblink

In the xi_service_notification_handler, I've added --kb_link="$_SERVICEkblink$"

Then, in the notification message for the user, I've added "KB link: %kb_link%"

I believe this is set up correctly. However, when the alert fires, in the email message, I see:
"KB Link:$" -- the dreaded missing variable!

Our version of Nagios XI is 5.5.4


Any suggestions on what I'm doing wrong?


-- Mike Beebe

Re: Free Variables not displaying in service alert messages

Posted: Tue Jan 29, 2019 11:49 am
by scottwilkerson
Change this in the command from this

Code: Select all

$_SERVICEkblink$
to this

Code: Select all

$_SERVICEKBLINK$
from the doc
Custom variable names are converted to all uppercase before use
https://assets.nagios.com/downloads/nag ... tvars.html

Re: Free Variables not displaying in service alert messages

Posted: Tue Jan 29, 2019 11:59 am
by mbeebe
Hi Scott,

This absolutely, positively 100% fixed my issue.

As a nb, the information you provided me is not trivial and not well-worded. I would think better wording would be:

WARNING: you must use upper-case for service/host variable names unless you want to waste 6 hours of your life slamming your head against the desk while you try to figure out why the darned variable name never shows up in your email.

Just a suggestion. ;)

Thank for your help!

-- Mike Beebe

Re: Free Variables not displaying in service alert messages

Posted: Tue Jan 29, 2019 12:12 pm
by scottwilkerson
mbeebe wrote:Hi Scott,

This absolutely, positively 100% fixed my issue.

As a nb, the information you provided me is not trivial and not well-worded. I would think better wording would be:

WARNING: you must use upper-case for service/host variable names unless you want to waste 6 hours of your life slamming your head against the desk while you try to figure out why the darned variable name never shows up in your email.

Just a suggestion. ;)

Thank for your help!

-- Mike Beebe
Noted!

Glad your issue is resolved!

Locking thread