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

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

$
0
0

Hi Photon

Thanks for your reply.

 

I'm using the python API script 'api_example.py' method: 'create_event_on_device' from the official documentation:

http://community.zenoss.org/servlet/JiveServlet/downloadBody/13242-102-1-16717/Zenoss_JSON_API.zip

 

method:

 

def create_event_on_device(self, device, severity, summary):

        if severity not in ('Critical', 'Error', 'Warning', 'Info', 'Debug', 'Clear'):

            raise Exception('Severity "' + severity +'" is not valid.')

 

 

        data = dict(device=device, summary=summary, severity=severity,

                    component='', evclasskey='', evclass='')

        return self._router_request('EventsRouter', 'add_event', [data])

 

 

 

The call is:

event = api.create_event_on_device('testDevice', 'Warning', 'TEST! zenoss api new event')

 

print event:

{u'uuid': u'96bc2155-6a3a-422f-901c-ccd7370d27c7', u'tid': 1, u'result': {u'msg': u'Created event', u'success': True}, u'action': u'EventsRouter', u'type': u'rpc', u'method': u'add_event'}

 

 

I need to get the 'evid' of this 'uuid'

 

Thanks


Viewing all articles
Browse latest Browse all 783

Trending Articles