1. About TALES Expressions

TALES is syntax you can use to retrieve values call methods on Zenoss objects. Several fields in Zenoss accept TALES syntax, including command templates, event mapping transforms, user commands, event commands, zProperties, zLinks and others.

Commands (those associated with devices as well as those associated with events) can use TALES expressions to incorporate data from the related devices and/or events. TALES is a syntax for specifying expressions that let you access the attributes of certain objects such as a device or an event in Zenoss. For additional documentation on TALES syntax please see the TALES section at:

http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx

Depending on the context you may have access to a device and/or an event. Below is a list of the attributes and methods you may wish to use on device and event objects. The syntax for accessing device attributes and methods is ${dev/attributename}, so for example to get the manageIp of a device you would use ${dev/manageIp}. For events, the syntax is ${evt/attributename}

A command to ping a device might look like this. The ${..} is a TALES expression to get the manageIp value for the device.

{{{
ping -c 10 ${dev/manageIp}
}}}

More Examples:

DNS forward lookup

(assumes device/id is a resolvable name)

{{{
host ${device/id}
}}}

DNS reverse lookup

{{{
host ${device/manageIp}
}}}

SNMP Walk

{{{
snmpwalk -v1 -c${device/zSnmpCommunity} ${here/manageIp} system
}}}

To use these expressions effectively you need to know which objects, attributes and methods are available to you in which contexts. Usually there is a dev and/or device which allows you access the device in a particular context. Contexts related to a particular event usually have evt and/or event defined. Some available attributes for each of these classes are listed below. List items with parenthesis after them are methods and much have the parenthesis included in the TALES expression to function correctly.