Page 1 of 1

use of Custom Variable/macro i Actions component

Posted: Tue Apr 14, 2015 8:10 am
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.

Re: use of Custom Variable/macro i Actions component

Posted: Tue Apr 14, 2015 10:05 am
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?

Re: use of Custom Variable/macro i Actions component

Posted: Wed Apr 15, 2015 1:22 am
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?

Re: use of Custom Variable/macro i Actions component

Posted: Wed Apr 15, 2015 9:21 am
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

Re: use of Custom Variable/macro i Actions component

Posted: Wed Apr 15, 2015 1:34 pm
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.

Re: use of Custom Variable/macro i Actions component

Posted: Wed Apr 15, 2015 1:39 pm
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

Re: use of Custom Variable/macro i Actions component

Posted: Sun Apr 19, 2015 10:22 pm
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

Re: use of Custom Variable/macro i Actions component

Posted: Mon Apr 20, 2015 10:40 am
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?

Re: use of Custom Variable/macro i Actions component

Posted: Tue May 05, 2015 12:47 am
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?