passing command line parameters to plugins

Marc Powell marc at ena.com
Wed Jun 15 19:44:37 CEST 2005



> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Cam
> Sent: Wednesday, June 15, 2005 12:23 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] passing command line parameters to plugins
> 
> Hi,
> 
> I'm trying to use the check_http plugin to check a webserver running
> on an unusual port number.  the syntax at the command line is
> check_http -p <foo> <host>.  to get it working in my services.cfg, i
> just use the literal command-line approach w/ the check_command (e.g.,
> check_command "/usr/lib/nagios/plugins/check_http -p 2584 aspapp1".
> It seems like the "standard" way is to use the
> "check_http!commandargs" approach, but i'm not sure how that's
> supposed to work w/ the '-p', i've tried "check_http!-p!2584" (w/out
> the quotes), but that doesn't work... what's the syntax for that?

http://nagios.sourceforge.net/docs/1_0/macros.html details the macros
available and where they can be used. You're interested in the $ARGx$
macros. By example --


# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -p $ARG1$ $HOSTADDRESS
        }

# Service definition
define service{
        use                             generic-service
        host_name                       some_host
        service_description             some_description
        check_command                   check_http!2584
        }

More arguments can be passed with more '!'s --

command_line    $USER1$/check_http -p $ARG1$ -I $HOSTADDRESS -H $ARG2$
-wt $ARG3$ -ct $ARG4$ -to $ARG5$

check_command	check_http!2584!www.somesite.com!20!30!35

The above would translate to --

check_http -p 2584 -I aspapp1 -H www.somesite.com -wt 20 -ct 30 -to 35.

--
Marc 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
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