4. Auto-Running Commands Based on Events

Zenoss allows you to set up commands to automatically be run against a device based on an event entering into the system.

To run events based on Events:

  1. 1.From the Zenoss Dashboard, from the left navigation menu, in the Management area, select Event Manager.

    The Event Manager Edit tab appears.

  2. Click the Commands tab.

    The Commands tab appears.

  3. Enter a name for the new Command, and click the Add button.

    The new command appears in the command list.

  4. Click on the name of the new command in the command list to give the command its attributes.

    The Edit Command window appears.

    Figure 18.4. Edit Event Command Page

    Edit Event Command Page

  5. Enable the command by setting the Enabled box to True.

  6. Now set the other attributes for the command change the default timeout if necessary. Default timeout for the command is 60 seconds.

  7. You can also change the delay for the command so there is a gap between when the conditions for the command to be run are met and when the command actually runs.

  8. In the Command area, enter the command you want to run when the conditions are met. These commands use TALES expressions. (See the section on TALES Expressions for more detail.)

  9. In the clear Command area, enter a command to be run once the event has cleared.

    Commands are built using TALES Expressions. Documented in the Appendix. When the conditions in the Where clause are met, the command you create runs. The power of this command and where and what you can run is only limited by the power of the scripts you create and the permissions on the machine where you want to execute the commands.

    This is optional, but could be useful if, for example, you were running an SMS modem separate from your alerting rules and wanted to send on message in the Command area to send an SMS message if Ping went down, and then when the Ping Down event was clear, you wanted to send an additional message from the SMS modem that it is up.

  10. At this point you use the “Where” area to set the conditions for this Command to be run.

  11. In the Add Filter drop down select the filters for your Command.

  12. You can filter on the Following Event cases:

    • Agent

    • Count

    • Device Class

    • Device Priority

    • Event Class Key

    • Facility

    • Manage

    • ntevid

    • Priority

    • Component

    • Device

    • Device Groups

    • Event Class

    • Event State

    • IP Address

    • Message

    • OwnerId

      You can add as many conditions as you want to further narrow the cases in which the Command will be executed.

  13. Once you have completed setting up the conditions, click the Save button. Now the command is entered and will run when the conditions are met.