Page 1 of 1

Trying to understand $ARG$

Posted: Mon Aug 12, 2013 7:05 pm
by toleolu
I copied this code from a post on the forum, hoping I could use this to see if I understand this macro.

This line comes from the posters command.cfg file:

command_line $USER1$/check_nt -H ~HOSTADDRESS$ -p 12489 -s <passwd> -v FILEAGE -l $ARG1$ -w $ARG2$ -c $ARG3$

Then in the services definition file there's this line:

check_command check_nt_fileage!"c:\\epoca\\temp\\nani.ftp" -w2 -c5

Is -w2 the value for $ARG2$ and -c5 the value for $ARG3$? And if that's correct, where is $ARG1$?

Thanks

Re: Trying to understand $ARG$

Posted: Tue Aug 13, 2013 9:53 am
by slansing
In service definitions ARG's are separated by "!'s", hence, you would need to add additional "!'s" after each text string to denote the following text being set to the next numerically listed argument.

In other words, if you are trying to use all of those arguments you would define your service like so:

Code: Select all

check_command check_nt_fileage!"c:\\epoca\\temp\\nani.ftp"!2!5 
You should not need to have the added "-w2 or -c5" in there as that would double up the already hard coded values in the command, as well as not having the proper space after them.

Re: Trying to understand $ARG$

Posted: Tue Aug 13, 2013 10:14 am
by sreinhardt
Just as a warning, HOSTADDRESS should also have $s around it. Otherwise, the $arg#$ variables are used in check definitions to accept values from host or service check definitions. The arguments are separated by !, so in your example:

Command(check_nt): command_line $USER1$/check_nt -H ~HOSTADDRESS$ -p 12489 -s <passwd> -v FILEAGE -l $ARG1$ -w $ARG2$ -c $ARG3$
Service Check: check_nt!password!c:\path\to\file!30!45

Arg1 = password
Arg2 = c:\path\to\file
Arg3 = warning value
Arg4 = critical value

These are completely variable for each definition and you may use all, some, or none of them.

Re: Trying to understand $ARG$

Posted: Tue Aug 13, 2013 11:56 am
by toleolu
Thanks