import os
date1 = datetime.datetime.now().isoformat()
date2 = ((datetime.datetime.now()-datetime.timedelta(minutes=1)).strftime("%Y-%m-%dT%H:%M:%S"))
def itoa_nodes(a):
itoa_nodes = os.popen(a).read()
q_node = []
for nd in str(itoa_nodes).strip().split('},'):
b = nd.replace('\n','').replace('\r','').replace(' ','').replace('"','').replace('{','').replace('}','').replace(']','')
q_node.append(b)
q_nodes = q_node[:0]
q_nodes.extend(q_node[1:])
return q_nodes
a = ''
a +='curl -X POST "http://10.202.149.51/api/secstats" -i -H "Authorization:token et44bf919hc62bja9488lq846dp0e4bbgfc6ff4b" -H "Accept:application/vnd.crossflow.bpc+json;indent=4" -H "Content-Type:application/json" -d \'{"earliest":"' + date2 + '", "latest":"' + date1 + '", "datasources":[{"spv":"app4","cap":"cap18"}],"indicators":["trans_count","duration","succ_rate"],"granularity":"1s","dimensions":["ts","trans_type"]}\''
msg = itoa_nodes(a)
df = pd.DataFrame(msg)
df.to_csv('/data/disk10/dockerdata/BpmMessage/核心产品化系统_sh_' + date1 + '.txt',sep='\t',index=False)
frame = pd.read_excel(input_file1,index_col=0)
data_lupin1 = pd.DataFrame(pd.read_table('logs/password.txt',sep='\t',names = ["time_end","time_start","user_alias","label"]))