use of Custom Variable/macro i Actions component

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mkeil77
Posts: 34
Joined: Sun Mar 09, 2014 5:59 am

use of Custom Variable/macro i Actions component

Post by mkeil77 »

Hi,

i was wondering if there is any possibility to use the macros _HOSTxxx ore _SERVICExxx
in the Actions Component in regards to an URL?

sample below

Action Type: URL
URL / Command: teamviewer8://remotecontrol?connectcc=%_HOSTTVID%
Target: _blank
Action Text: Teamviewer

but it seams that %_HOSTTVID% is not getting replaced by the value of the _TVID variable of the host.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: use of Custom Variable/macro i Actions component

Post by jdalrymple »

I'm not sure I understand how you're expecting the _TVID to suppliment the _HOSTXXXX bit.

These macros are immutable, you cannot macro in a macro so to speak. Is that what you're trying to do?
mkeil77
Posts: 34
Joined: Sun Mar 09, 2014 5:59 am

Re: use of Custom Variable/macro i Actions component

Post by mkeil77 »

Hi,

my understanding was, and maybe i'm totally wrong here, that if i setup a variable _TVID for one host in:
'Misc Settings' -> 'Manage Variable Definitions' that i would be able to use it later with the macro _HOSTxxx, or in this case _HOSTTVID
The question then is if the same could be used in the Actions Component for an URL.

if not would there be any other option? i already tried to use the action_url in the'Misc Settings' but that would be only available in Nagios core.


jdalrymple wrote:I'm not sure I understand how you're expecting the _TVID to suppliment the _HOSTXXXX bit.

These macros are immutable, you cannot macro in a macro so to speak. Is that what you're trying to do?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: use of Custom Variable/macro i Actions component

Post by jdalrymple »

Sorry, I misunderstood and you are right about how custom macros work. Unfortunately custom macros aren't part of the available list for the command/URL field of the actions component. Reference the bottom of this document for what is available:

http://assets.nagios.com/downloads/nagi ... ponent.pdf
mkeil77
Posts: 34
Joined: Sun Mar 09, 2014 5:59 am

Re: use of Custom Variable/macro i Actions component

Post by mkeil77 »

thats what i was afraid of. do you see any other possibility to achieve this.
I was already searching of a possibility to get the action_url icon back in Nagios XI but it seems to be only available in Nagios Core, and switching to it every time seems not to be the solution.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: use of Custom Variable/macro i Actions component

Post by abrist »

Alright, this is round about, but may work. You could perform a query to the json api to fetch/parse the custom variables and then use them in your custom actions script. Take a go through the json query generator at:
http://<server ip>/nagios/jsonquery.html
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.
mkeil77
Posts: 34
Joined: Sun Mar 09, 2014 5:59 am

Re: use of Custom Variable/macro i Actions component

Post by mkeil77 »

Hi Abrist,

thanks for the tip. will look into this and see if i can get it to work that way
abrist wrote:Alright, this is round about, but may work. You could perform a query to the json api to fetch/parse the custom variables and then use them in your custom actions script. Take a go through the json query generator at:
http://<server ip>/nagios/jsonquery.html
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: use of Custom Variable/macro i Actions component

Post by lmiltchev »

thanks for the tip. will look into this and see if i can get it to work that way
Do you want us to keep this topic open?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mkeil77
Posts: 34
Joined: Sun Mar 09, 2014 5:59 am

Re: use of Custom Variable/macro i Actions component

Post by mkeil77 »

you can close it, thanks.

lmiltchev wrote:
thanks for the tip. will look into this and see if i can get it to work that way
Do you want us to keep this topic open?
Locked