Skip to content

Commit

Permalink
adding example to create heartbeats per kb: https://support.zenoss.co…
Browse files Browse the repository at this point in the history
  • Loading branch information
linkslice committed Apr 26, 2023
1 parent 2478717 commit 57fa825
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/EventsRouter_createHeartbeat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/env python
from __future__ import print_function

import zenApiLib
import sys
from pprint import pprint

def heartbeats(api):
data = {
'summary': 'Hearbeat',
'device': 'bryantest',
'component': '',
'severity': 5,
'evclass': '/Heartbeat',
'evclasskey': 'none',
'message': 'test',
'monitor': 'AustinCollectorPool',
'timeout': 120
}
rsp = api.callMethod('add_event', **data)
if rsp.get('result', {}).get('success', False) == False:
print("ERROR")
pprint(rsp)
sys.exit(1)
return rsp.get('result', {}).get('success', 'Unknown')


if __name__ == '__main__':
api = zenApiLib.zenConnector(routerName = 'EventsRouter')
pprint(heartbeats(api))

0 comments on commit 57fa825

Please sign in to comment.