User commands
User commands allow you to execute arbitrary shell commands from Resource Manager. A user command is executed in its appropriate container rather than the remote device unless the command explicitly uses SSH to connect to the remote device.
You can define and run user commands on a device or organizer (device class, system, group, location, or component group). You also can define commands globally. The User Commands menu bar shows the various functions that can be used in the User Commands screen.
Defining global user commands
Global commands appear in the Commands list of options located at the top of the Devices page.
To define global user commands:
- From the navigation menu, choose Advanced > Settings.
- In the left panel, choose Commands.
- In the Define Commands area, click the action menu and choose Add User Command.
- In the Add User Command dialog box, specify a name for the command, and then click OK. Only letters, numbers, and underscores are allowed in command names. Spaces are not allowed.
- In the Define Commands page, specify a description of what the command will do.
- In the Command section, enter the TALES expression-based command you want to run on the device.
- Enter your system account password for confirmation, and then click Save. The command is saved and added to the commands menu.
Global commands also can be edited from a specific device. Changes to a global command from a device are not limited to that device.
Running global user commands
To run a global user command, select one or more devices in the devices list, and then select a command from the Commands list of options.
Defining user commands for a single device
To define a user command for a device:
- From the navigation menu, choose INFRASTRUCTURE.
- In the device list, click a device name.
- In the left panel, choose Device Administration.
- In the User Commands area, click the Add a User Command icon.
- In the Add New User Command dialog box, specify
the following information about the user command:
- Name - Name of the user command.
- Description - Description of what the command will do.
- Command - TALES expression-based command you want to run.
- Confirm Password - Enter your system account password for confirmation.
- Click Submit. The command is saved and added to the user commands menu.
- *Optional: *Test the command by selecting the command from the list and clicking the Run icon.
Running user commands for a single device
To run a command defined for a single device:
- Navigate to the INFRASTRUCTURE > DEVICES page.
- Click the device name in the device list to open the Device Overview page.
-
Select the command from the Commands list of options located at the bottom of the page.
Defining user commands for all devices in an organizer
To define a user command for all devices in an organizer:
- On the INFRASTRUCTURE page, select a device organizer in the devices hierarchy; for example, /Server/Linux.
- Click Details.
- In the left panel, select Device Administration.
-
In the User Commands area, click the Add a User Command icon.
-
Enter the following information about the user command:
- Name - Name of the user command.
- Description - Description of what the command will do.
- Command - TALES expression-based command you want to run.
- Confirm Password - Enter your system account password for confirmation.
- Click Submit. The command is saved and added to the user commands menu.
- *Optional: *Test the command by selecting the command from the list and clicking the Run icon.
Running user commands for devices in an organizer
To run a command defined for devices in an organizer:
- On the INFRASTRUCTURE page, select a device organizer.
- Select one or more devices in the filtered view.
-
Select the command from the Commands list located at the top of the page.
Example
This example shows how to create an echo user command. You can see the use of TALES expressions in the definition of this command.
-
Add a command called "echoDevice"
-
In the command definition, echo the name and IP address of the device:
echo name = ${here/id} ip = ${here/manageIp}
In a TALES expression, here is the object against which the expression is executed. Some TALES expressions in the system have other variables (such as evt for event, and dev or device for the device). For more information, see TALES expressions.
-
Select a device and then run the command.
-
Edit the command to add more information:
echo name = ${here/id} ip = ${here/manageIp} hw = ${here/getHWProductName}
-
Run the command against a group of devices and view the command outputs.