parser.add_argument( 'sysdig_token', help= 'You can find your token at https://app.sysdigcloud.com/#/settings/user') parser.add_argument('name') args = parser.parse_args() tags = None if args.tags: tags = json.loads(args.tags) # # Instantiate the SDC client # sdclient = SdMonitorClient(args.sysdig_token) # # Post the event using post_event(self, name, description=None, severity=None, event_filter=None, tags=None) # ok, res = sdclient.post_event(args.name, args.description, args.severity, args.scope, tags) # # Return the result # if ok: print('Event Posted Successfully') else: print(res) sys.exit(1)
sdc_token = sys.argv[1] name = sys.argv[2] description = sys.argv[3] scope = 'host.hostName = "foo" and container.name = "bar"' tags = {"tag1": "value1"} severity = 6 if len(sys.argv) < 4: severity = int(sys.argv[4]) # # Instantiate the SDC client # sdclient = SdMonitorClient(sdc_token) # # Post the event # ok, res = sdclient.post_event(name, description, severity, scope, tags) # # Return the result # if ok: print('Event Posted Successfully') else: print(res) sys.exit(1)