Passing Macros from Host definition to check definition

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Passing Macros from Host definition to check definition

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Passing Macros from Host definition to check definition

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Re: Passing Macros from Host definition to check definition

Post 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
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Re: Passing Macros from Host definition to check definition

Post by arnab.roy »

Found it sorry for being blind!!!!!!!!!!arghhh
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Passing Macros from Host definition to check definition

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked