Page 1 of 1

Where are commands and variables in "commands.cfg" defined

Posted: Sun Jun 01, 2014 10:53 am
by chethankrish
Hi All,

Can you please let me know where are all the variables used in "commands.cfg" defined in Nagios ? Below is an example
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
Where are $USER1$, $ARG1$, $ARG2$, $ARG3$ variables defined ? And in which directory are "check_local_disk" and other commands defined in Nagios ?

I am running Nagios Core Version 4.0.6 in CentOS.

Regards,
Chethan Krishna.

Re: Where are commands and variables in "commands.cfg" defin

Posted: Sun Jun 01, 2014 1:47 pm
by millisa
These two pages of the documentation cover what you are asking:
Understanding Macros and How THey Work
Standard Macros in Nagios

Generally, the $USER#$ are defined in resources.cfg (at least that's where you'd normally put them). They are for things that are specific to your environment (USER1 typically is the location of your plugins). I like to put things in there like snmp community strings, an Identifier for this nagios system to use in the notification commands, and sometimes a user/password.

$ARG#$ are command argument macros - you set them in your service definition (the things you are trying to do checks for).

Re: Where are commands and variables in "commands.cfg" defin

Posted: Sun Jun 01, 2014 2:03 pm
by chethankrish
Thanks a lot. This helped a great deal :)