#options.params = "state=2&hostgroupid=505" options.state = 2 options.hostgroupid = 462 options.type = 0 options.service_state = "critical" options.host_group = 462 # Check for required options for option in ('host', 'username', 'password'): if not getattr(options, option): print 'Option %s not specified' % option parser.print_help() sys.exit() # Main program key = Ops.opspostsend(url=options.host, user=options.username, password=options.password) print "your session key is : ", key #ReqStatus.request_rest_status(token=key,username=options.username,params=options.params,state=options.state,servicetype=options.type,host=options.host,hostgroupid=options.hostgroupid) # binding data and interpret as dictionary format if key is not None: dataFile = ReqEvent.request_rest_event(token=key, username=options.username, params=options.params, service_state=options.service_state, host=options.host, host_group=options.host_group, raw=0) #ReqEvent.interpret_rest_event(dataFile=dataFile) data_frame = ReqEvent.interpret_rest_event_pandas_to_dataFrame(dataFile=dataFile) else: sys.exit("there is no key to get data") #print data_frame.groupby(['hostname', 'servicename']) # some specific dataframe view information and group data # ex: print data_frame # ex: print data_frame.head(n=10) # ex: print data_frame.groupby('hostname').apply(lambda subf: subf['servicename']) # ex: print data_frame.groupby('hostname').apply(lambda subf: subf['time'])