per host custom macros

David Mansfield nagios at dm.cobite.com
Wed Mar 29 19:55:16 CEST 2006



Terry wrote:
> You could maybe write an "intelligent" plugin to query the host
> information from another source based on the service name or something
> but nagios needs to know the IP address somehow.  Where would you want
> to put this information so nagios can perform the service
> appropriately?
> 

Something like:

define host {
	use generic-host
	host_name myhost.mydomain.com
	alias myhost
	address 1.2.3.4

	custom_macro FOOPROPERTY=AA:BB:CC:DD
	custom_macro BARVALUE=BigImportantValue

	hostgroups all_foo,all_bar
}

With:

define hostgroup {
	name all_foo
	alias all_foo
}

define service {
	hostgroup_name all_foo
	check_command check_foo
}

And finally, the payoff:

define command {
	command_name check_foo
	command_line $USER1$/check_foo -f $FOOPROPERTY$
}


> On 3/29/06, David Mansfield <nagios at dm.cobite.com> wrote:
>> Terry wrote:
>>> You can specify custom macros in resources.cfg:
>>>
>>> $USER2$="192.168.0.30"
>>> However, this is not what you want and is no different than specifying
>>> it in the command itself with $ARG#$ rather than using the
>> Right. This is useful for a global macro, but I'm looking for something
>> host specific.
>>
>>> $hostaddress$.  Pass the dnscacheaddress onto the command via the
>>> argument.
>>>
>>> check_dnscache -H $ARG1$
>>>
>>> service foo {
>>> check_command  check_dnscache!192.168.0.1
>>> ....
>>>
>>>
>> See my other reply where I have two strong arguments against doing it
>> this way (to summarize: host information in multiple places, one service
>> for each host instead of hostgroup).
>>
>>
>> David
>>
> 
> 


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list