--- GW IMAGE NOT DISPLAYED --- Defining Commands

Copyright 2006 GroundWork Open Source, Inc. (“GroundWork”).
All rights reserved. Use is subject to GroundWork commercial license.


Defining Commands

--- GW IMAGE NOT DISPLAYED --- How Do I Define a New Command?

Step 1 – Select Resource

  1. Select Commands from the Configuration menu options.
  2. Select New.
  3. In the Select Resource screen, check the resource macro to configure.
  4. The screen will change and the selected macro’s options will appear at the top of the screen.
  5. Select a Plugin to associate with the resource macro from the drop-down list.
  6. At this point, the resource macro may be edited and comments added.
  7. Select Next to continue.

    Figure 5.9.1a. Select Resource


    Table 5.9.1a. Select Resource

    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$).
    Plugin Selected plugin which will check local or remote resources or Services of some type. This is incorporated into the command line.
    Comment Optional comment area for this macro.

Step 2 – New Command

  1. In the Command Wizard screen, enter the properties (see Table 5.9.1b. below).
  2. Select Add to add the new Command. Cancel will exit the Command Wizard without saving.
  3. You will be prompted that the command has been saved. Select Continue.

    Figure 5.9.1b. New Command


    Table 5.9.1b. New Command

    Name Command name.
    Type Specify command type: Check = Service/Host Check Commands, Handlers; Notify = Notification Commands; Other = other commands (i.e. Performance Data Collectors).
    Command Line 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.
    Usage This shows how the command is defined on the Service.
    Test 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment