Where can arguments go?

Stuart Browne stuart.browne at ausregistry.com.au
Wed Feb 22 00:59:46 CET 2012


Hi,

> -----Original Message-----
> From: David Dyer-Bennet [mailto:dd-b at dd-b.net]
> Sent: Wednesday, 22 February 2012 10:42 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Where can arguments go?
> 
> I'm looking to use a special check command to verify routers are in
> operation by checking the main link port of the router (instead of the
> default ping).  I'm running into confusion, because I need to specify a
> port number in the host definition, and I can't really see how to do it.
> 
> I use soemthing like this for a template:
> 
> define host {
> 	name			snmp-switch	; The name of this host template
> 	use			generic-switch
> 	#check_command		check-host-alive ; Default command to check
> if routers
> are "alive"
> 	check_command		check-snmp-switch-alive $HOSTADDRESS$ $ARG1$
> $ARG2$
> 	register		0		; DONT REGISTER THIS - ITS JUST A
> TEMPLATE
> }
> 
> I'm not sure the args on the check_command line are legal  And I'm not
> sure that arguments on a "use snmp-switch" line referencing this could
> have arguments on them.

Arguments on the check_command line are perfectly valid, however you aren't using them correctly here.

Example time:

check_command	check_tcp!1500

Within a service or host definition, something like this would execute the defined command 'check_tcp' and pass it a $ARG1$ value of 1500.  This would be used like this:

define command {
        command_name    check_tcp
        command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}

This is documented in the Macros section:

http://nagios.sourceforge.net/docs/nagioscore/3/en/macros.html

> Is this a possible / sane thing to do?  Is this the right way to approach
> it, or am I missing a way that actually makes sense?
> 
> 
> --
> David Dyer-Bennet, dd-b at dd-b.net; http://dd-b.net/
> Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/
> Photos: http://dd-b.net/photography/gallery/
> Dragaera: http://dragaera.info

Stuart


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
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