Discussion:
Transform help
gebster
2012-10-03 17:43:39 UTC
Permalink
gebster [http://community.zenoss.org/people/gebster] created the discussion

"Transform help"

To view the discussion, visit: http://community.zenoss.org/message/68839#68839

--------------------------------------------------------------
Need help extracting the port info out of this snmp trap and assigning it to env.component

| snAgGblTrapMessage | OPTICAL MONITORING: Optic is not factory qualified, optical monitoring is not supported (port 5/24). Type : SFP 1GE-BX10-D-1490nm Vendor: FIBERXON INC. , Version: 10 Part# : FTM-9912C-S |
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/68839#68839]

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]
alex0cy
2012-10-05 05:44:14 UTC
Permalink
alex0cy [http://community.zenoss.org/people/alex0cy] created the discussion

"Re: Transform help"

To view the discussion, visit: http://community.zenoss.org/message/68866#68866

--------------------------------------------------------------
import re
try:
    p=re.match('.*port\ (.*)\).*', evt.snAgGblTrapMessage)
    evt.component=p.group(1)
except:
    evt.component='undefined'
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/68866#68866]

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]
gebster
2012-10-05 20:39:40 UTC
Permalink
gebster [http://community.zenoss.org/people/gebster] created the discussion

"Re: Transform help"

To view the discussion, visit: http://community.zenoss.org/message/68872#68872

--------------------------------------------------------------
Thanks for the help. Some of the messages were coming in funny so I found a way to filter on the brackets.



import re

p=re.search('\(([^)]*)\)', evt.snAgGblTrapMessage)
evt.component=p.group(1)



thanks again,
GB
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/68872#68872]

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]
alex0cy
2012-10-08 11:13:05 UTC
Permalink
alex0cy [http://community.zenoss.org/people/alex0cy] created the discussion

"Re: Transform help"

To view the discussion, visit: http://community.zenoss.org/message/68874#68874

--------------------------------------------------------------
I suggest you to put evt.component=p.group(1) in try/except, otherwise you will get alert in case there will be no match in pattern and as a result p.group(1) will be undefined.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/68874#68874]

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]
Loading...