1

I've set Zenoss 4.2.3 to get devices from our entire network from all subnets (INFRASTRUCTURE -> DEVICES). But it returns me the device list only with the IP address, it doesn't obtain the hostnames from both Windows and Linux machines.

How can I config it to obtain the names of the machines?

msmafra
  • 173
  • 3
  • 9

2 Answers2

4

"But it returns me the device list only with the IP address"

Do you mean in the infrastructure tab or are you referring to the emails from a notifier?

If in the notifier, there is a bug in Zenoss 4.2 where the device.id is used instead of device.title in email notifications.

To fix, put the following transform into the root "/" event class.

d = dmd.Devices.findDevice(evt.device)
if d is not None:
  evt.device_title = d.title
else:
  evt.device_title = d.id

and then in your notification "Content" tab, use the following

Message (subject) Format: [zenoss] **${evt/device_title}** - ${evt/summary}
Body Format: 

Location: ${evt/zenoss.device.groups}
Device: **${evt/device_title}**
Component: ${evt/component}
Severity: ${evt/sevword}
Time: ${evt/lastTime}

Message:

${evt/message}

a href="${urls/eventsUrl}">Device Events

a href="${urls/eventUrl}">Event Detail

a href="${urls/ackUrl}">Acknowledge

a href="${urls/closeUrl}">Close

Hope this helps.

2

I spent hours researching this yesterday and hopefully I can save someone some pain. I discovered two answers for this, and we'll start with the easy one.

No transforms required

In the Notification Content tab, simply replace

${evt.device}

with

${eventSummary/actor/element_title}

Discovered via: http://community.zenoss.org/message/71252#71252
(thanks to Philip Warren)
 

Using transforms

Ophir's answer above will work for real events, but I discovered that it will not work for any manually created (a.k.a. test) events. The Transform itself will parse properly, but, for whatever reason, test events cannot properly parse custom attributes used in the Notification Contents and will fail with an "Unable to perform TALES evaluation" error. This makes it difficult to test custom attributes, so hopefully Zenoss will fix this soon.

I would also recommend changing the last line of his transform, otherwise it might fail when "d" is not found. Here's the full reworked Transform code:

d = dmd.Devices.findDevice(evt.device)
if d is not None:
  evt.device_title = d.title
else:
  evt.device_title = evt.device.title

Discovered via: http://www.eventenrichment.com/zenoss-event-enrichment-5-min-less
 

Um... How do I Transform anything?

For those that haven't done it before (like me, as of yesterday) you do not need to use Zope to get to the Transform area. Just follow these steps in Zenoss to add a Transform to the Root Event:

  1. Click on Events > Event Classes
  2. Click on the bottom-left gear
  3. Click on Transform
  4. Type the code in to the Transform field area
  5. Click Save

If you feel like using Zope instead (because "Danger" is your middle name) then you can browse to http[s]://yourserver.com[:port]/zport/dmd/Events/manage and then click on the Properties tab to get to the Transform field.