First I'll explain what I'm trying to do. I'd like to map the Snmp Agent Down
event and apply a transform that rotates the current zSnmpCommunity value one
to the right in a round robin fashion from the zSnmpCommunities list on the
device.
Now note because the event has no eventClassKey I have to use the Transform for
the /Events/Status/Snmp event which I got to by More -> Transform.
The small script I wrote looks like so.
if evt.summary.startswith('snmp agent down '):
evt.summary = "Snmp Agent down, rotating snmp community"
CommunityList = dev.zSnmpCommunities
try:
i = CommunityList.index(dev.zSnmpCommunity)
except ValueError:
i = -1 # no match, keep the custom value
evt.summary = "Snmp Agent down, custom value retained"
if i != -1:
i = (i + 1) % len(CommunityList)
dev.zSnmpCommunity = CommunityList[i]
Now this works to some extent because my new events had the correct summary but
no change in the zSnmpCommunity property???
I tried doing some changing around like removing the try/except and even
removing the evaluation entirely because nothing else uses that event class as
far as I know.
Nothing has worked. I also tried just using one line in the transform to set
the eventClassKey which worked and allowed me to have an eventclass mapping
which matched correctly.
Seems my code inside the eventclassmapping wont allow me to save unless the
try/except is removed but once again no changes in the community.
I am totally lost as to what else to do. I should note that ZenTrap.log shows
nothing out of the ordinary but if I have a blatent messup like setting an
integer equal to the evt.summary shows TypeErrors in the log so I know that log
is where my errors will go.
At this point I've tried everything and my next step is to simply write a
python script to check for those events and do the proper modification but that
would ruin my ability to repackage this functionality into a ZenPack which I
plan on doing.
Any ideas from the masters? I'd rather get this working the right way if at all
possible.
Thanks in advance.
-------------------- m2f --------------------
Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=15682#15682
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users