Quantcast
Channel: Zenoss Community: Message List
Viewing all articles
Browse latest Browse all 1097

Re: API: How to add and manage event using JSON python API

$
0
0

Hi !

 

  As far as I know, evid and uuid are the same... Where you can find a difference, is in the MySQL database where the uuid is stored as a binary representation. Also, you can aknowledge an event using the zepfacade methods and an event's uuid. I never used the JSON API but using a dmd script, it can go this way:

    zendmd

     >>> from Products.Zuul import getFacade

     >>> from zenoss.protocols.jsonformat import from_dict

     >>> from zenoss.protocols.protobufs.zep_pb2 import EventSummary

     >>> from Products.ZenEvents.events2.proxy import EventSummaryProxy

     >>> zep = getFacade('zep')

     >>> filter1 =zep.createEventFilter(uuid=u'43e33625-9dbb-42b1-a609-6750481b4c9b')

     >>> eventDict = zep.getEventSummariesGenerator(filter=filter1).next()

     >>> eventDict['uuid']

     >>> evt = EventSummaryProxy(from_dict(EventSummary, eventDict))

     >>> evt.evid

     >>> zep.acknowledgeEventSummaries(eventFilter=filter1)

 

You should find out that eventDict['uuid'] == evt.evid and that your event has been aknowledged

 

Good luck,

 

--

Fayçal


Viewing all articles
Browse latest Browse all 1097

Trending Articles