-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding example to create heartbeats per kb: https://support.zenoss.co…
- Loading branch information
linkslice
committed
Apr 26, 2023
1 parent
2478717
commit 57fa825
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |