tcaiazza
2011-11-28 20:51:11 UTC
tcaiazza [http://community.zenoss.org/people/tcaiazza] created the discussion
"Help improving an event transform"
To view the discussion, visit: http://community.zenoss.org/message/62866#62866
--------------------------------------------------------------
I have an event transform which I was hoping someone could help improve for me. The first part is I want to load the device object, so I've seen a bunch of examples where it is written like this
for d in dmd.Devices.getSubDevices():
if d.id == evt.device:
 dev = d
Does anyone know if there is a way to say something like this instead of having to loop through all the devices?
d = dmd.Devices.getDevice(devicename)
Next I want to load a specific interface object for that device, so I have this
for int in dev.os.interfaces():
if int.ifindex == evt.pimNeighborIfIndex:
 ifdescr = int.id
Again, I was hoping there was a way I could say something like whats below without having to loop through all the interfaces.
int = dev.os.interface( evt.pimNeighborIfIndex )
--------------------------------------------------------------
Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62866#62866]
Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
"Help improving an event transform"
To view the discussion, visit: http://community.zenoss.org/message/62866#62866
--------------------------------------------------------------
I have an event transform which I was hoping someone could help improve for me. The first part is I want to load the device object, so I've seen a bunch of examples where it is written like this
for d in dmd.Devices.getSubDevices():
if d.id == evt.device:
 dev = d
Does anyone know if there is a way to say something like this instead of having to loop through all the devices?
d = dmd.Devices.getDevice(devicename)
Next I want to load a specific interface object for that device, so I have this
for int in dev.os.interfaces():
if int.ifindex == evt.pimNeighborIfIndex:
 ifdescr = int.id
Again, I was hoping there was a way I could say something like whats below without having to loop through all the interfaces.
int = dev.os.interface( evt.pimNeighborIfIndex )
--------------------------------------------------------------
Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62866#62866]
Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]