Subject: |
RE: Zenoss 4.2.5 Event Transform |
Author: |
Pheripheral Pheripheral |
Posted: |
2020-12-11 09:02 |
Hi,
I came across a similar problem recently, where the event attribute had .0 or .1 etc.. on the end so changed my transforms to use something like the below instaed of getAttr():
# get attribute
for key in evt.details._map.keys():
if key.startswith('ifDescr'):
ifDescr = evt.details.get(key)
break
Essentially, looping through all the event fields and checking which one starts with the string that you're looking for.
As with most things I figured this out with the help of one of Jane Curry's pdf documents, I forget which one.
Hope this helps
------------------------------
Pheripheral Pheripheral
------------------------------
Subject: |
RE: Zenoss 4.2.5 Event Transform |
Author: |
Davide Mancosu |
Posted: |
2020-12-11 15:07 |
Hi,
Thank you for your answer. I'm not a python developer, I work with PHP and javascript.
I have just finished now with a script that works.
This is my code:
if device and evt.DeviceGroups and evt.DeviceGroups == '|/VSTP':
for i in range(1, 500):
if (hasattr(evt.details, 'ifDescr.21618.%s' % (i))):
descr=getattr(evt.details,'ifDescr.21618.%s' % (i))
evt.summary = descr
evt.component = descr
it's not as simple and clean as what you suggested but it works. Anyway, out of curiosity, I'll test with the code you suggested.
Regards
------------------------------
Davide Mancosu
system administartor
Tiscali Italia S.p.A.
Cagliari
------------------------------