Select Commands from the Configuration menu options.
In the Select Resource screen, check the resource macro to configure.
The screen will change and the selected macro’s options will appear at the top of the screen.
Select a Plugin to associate with the resource macro from the drop-down list.
At this point, the resource macro may be edited and comments added.
Select Next to continue.
Figure 5.9.1a. Select Resource
Table 5.9.1a. Select Resource
This is used to specify an optional resource file that can contain $USERn$ macro definitions. $USERn$ macros are useful for storing usernames, passwords, and items commonly used in command definitions (like directory paths). User macros can be defined in one or more resource files. Nagios® supports up to thirty-two user macros ($USER1$ through $USER32$).
Selected plugin which will check local or remote resources or Services of some type. This is incorporated into the command line.
Optional comment area for this macro.
Step 2 – New Command
In the Command Wizard screen, enter the properties (see Table 5.9.1b. below).
Select Add to add the new Command. Cancel will exit the Command Wizard without saving.
You will be prompted that the command has been saved. Select Continue.
Figure 5.9.1b. New Command
Table 5.9.1b. New Command
Specify command type: Check = Service/Host Check Commands, Handlers; Notify = Notification Commands; Other = other commands (i.e. Performance Data Collectors).
This directive is used to define what is actually executed by Nagios® when the command is used for Service or Host checks, Notifications, or event handlers. An editable field, before the command line is executed, all valid macros are replaced with their respective values. See the documentation on macros for determining when you can use different macros. Note that the command line is not surrounded in quotes. Also, if you want to pass a dollar sign ($) on the command line, you have to escape it with another dollar sign.
This shows how the command is defined on the Service.
Enter a Host and arguments for the command line. When you click the “Test” button this parses through the command definition, performs the macro substitutions, inserts the hostname from the host box, puts the resulting command into a shell command line and executes, returning the results of the execution in the box to the right.