Administration Guide

  • Docs Home
  • Community Home

2. Defining User Commands

To define a user command:

  1. From any device you have loaded into Zenoss, open the Device page menu, and then select More > Administration.

    The Administration tab appears.

  2. From Define Commands table menu, select Add User Command.

    The Add User Command dialog appears.

    Figure 10.1. Add User Command

    Add User Command

  3. In the Command Id field, enter a name for the command, and then click OK.

    The Define Command page appears.

    Figure 10.2. Define User Command

    Define User Command

  4. In the Description field, enter a brief description of what the command will do.

  5. In the Command section, enter the TALES expression-based command you want to run on the selected device or devices.

  6. Click Save.

    The Command is saved and added to the command menu so you can choose to run it at any time.

2.1. User Command Example: Echo Command

This section will walk you through creating an echo user command. You can see the use of TALES expressions in the definition of this command.

  1. Go to the Settings Manage tab.

  2. Add a new command called “echoDevice”

  3. Echo the name and IP of the device

    echo name = ${here/id} ip = ${here/manageIp}

    In a TALES expression ‘here’ is the object that the expression is executed against. Some TALES expressions in Zenoss have other variables like evt for event and dev or device for the device. See the TALES Expression appendix for more information on the syntax of the various TALES expressions.

  4. Go to a device and run this command.

  5. Now go back to the editing of this command and add some more information to the command.

    echo name = ${here/id} ip = ${here/manageIp} hw = ${here/getHWProductName}
  6. Now try running the command against a group of devices and see the command outputs.