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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
chethankrish
Posts: 5
Joined: Fri May 09, 2014 4:07 pm

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

Post 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.
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

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

Post 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).
chethankrish
Posts: 5
Joined: Fri May 09, 2014 4:07 pm

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

Post by chethankrish »

Thanks a lot. This helped a great deal :)
Locked