Event transformation is a cool feature of Zenoss, but care must be taken to avoid slowing down Zenoss too much, as badly performing event transformations applied to a large number of events might slow down Zenoss. Besides, any exception within an event transformation ends up in $ZENHOME/log/zeneventd.log, so your code needs extra care to avoid breakages.
One interesting feature available within a transformation is the status (up, down) of another device (meaning, not the device for which Zenoss is now running a transform). Say you detect the failure of a device but before alerting, you want to check if the other side of the WAN link is down. This is how you do that test under Zenoss 4.x (5.x might work as well, no instance to test it):
# ... # part of the code where you find out the remote_device_name # e.g. by parsing your smart interface description # ... remote_host = device.findDevice(remote_device_name) if remote_host and remote_host.getStatus() > 0: evt.summary += ' (remote is down)' # remote host is down so only INFO evt.severity = 2
Under Zenoss 3.x, I used that code instead of getStatus(), but it is wrong and very slow under Zenoss 4.x, so better avoid. It’s here for memory and people looking for that same issue that costs me 2h.
... if (remote_host.pingStatus() != 0): # avoid