Page 1 of 1

Passing Macros from Host definition to check definition

Posted: Fri May 11, 2012 10:20 am
by arnab.roy
Hi All,

Just trying something , is it possible to pass a macro argument from the hostdef to my actual check_plugin it works when passed from the service def. Basically need a way to pass the snmp com string for the host instead of defining within each service check def.

Any help would be appreciated.

CHeers
Arnab

Re: Passing Macros from Host definition to check definition

Posted: Fri May 11, 2012 10:57 am
by scottwilkerson
Yes.

For example, if you define in the host a variable

Code: Select all

_COMMUNITYSTRING  private
You can call that variable in all of the services with

Code: Select all

$_HOSTCOMMUNITYSTRING$

http://nagios.sourceforge.net/docs/3_0/macros.html

http://nagios.sourceforge.net/docs/3_0/ ... tvars.html

Re: Passing Macros from Host definition to check definition

Posted: Fri May 11, 2012 11:02 am
by arnab.roy
Thanks scott, however cant find a way to create a custom variable within nagiosxi /nagiosql CCM ? Sorry if I am being stupid/blind

Re: Passing Macros from Host definition to check definition

Posted: Fri May 11, 2012 11:11 am
by arnab.roy
Found it sorry for being blind!!!!!!!!!!arghhh

Re: Passing Macros from Host definition to check definition

Posted: Fri May 11, 2012 11:15 am
by scottwilkerson
Just for completeness for others looking for the solution, you can add the variables to a host in XI at the following location

Configure -> CCM -> Hosts -> Modify -> Misc Settings -> Free variable definitions

Fill in the following
Variable name (_VARIABLE)
Variable value

Click Instert
SAVE
Apply Configuration