Administration Guide

  • Docs Home
  • Community Home

1. About Tales Expressions

Use TALES syntax to retrieve values and call methods on Zenoss objects. Several fields in Zenoss accept TALES syntax; these include:

  • Command templates

  • User commands

  • Event commands

  • zLinks

Commands (those associated with devices and those associated with events) can use TALES expressions to incorporate data from the related devices 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, see the TALES section of the Zope Page Templates Reference:

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

Depending on context, you may have access to a device, an event, or both. Following is a list of the attributes and methods you may want to use on device and event objects. The syntax for accessing device attributes and methods is ${dev/attributename}. 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 ${device/manageIp}

1.1. 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} ${device/manageIp} system

To use these expressions effectively, you must know which objects, attributes, and methods are available, and in which contexts. Usually there is a device that allows you to access the device in a particular context. Contexts related to a particular event usually have event defined.