DC - Minor refactor/housekeeping

data-collector
Steve L. Nyemba 7 years ago
parent 39b32768e4
commit 6b23703aa2

@ -9,7 +9,7 @@ import requests
import pickle import pickle
import json import json
from threading import Thread, RLock from threading import Thread, RLock
ENDPOINT="https://dev.the-phi.com/monitor" ENDPOINT="https://the-phi.com/monitor"
class Collector(Thread) : class Collector(Thread) :
def __init__(self): def __init__(self):
Thread.__init__(self) Thread.__init__(self)
@ -23,12 +23,13 @@ class Collector(Thread) :
for id in ['apps','folders']: for id in ['apps','folders']:
if id in SYS_ARGS : if id in SYS_ARGS :
SYS_ARGS[id] = SYS_ARGS[id].split(',') SYS_ARGS[id] = SYS_ARGS[id].split(',')
scope=list(set(['apps','folders','sandbox'])& set(SYS_ARGS.keys()))
headers = {"key":SYS_ARGS["key"],"id":SYS_ARGS["id"],"scope":json.dumps(scope)}
headers = {"key":SYS_ARGS["key"],"id":SYS_ARGS["id"]} #,"scope":json.dumps(scope)}
headers['content-type'] = 'application/json' headers['content-type'] = 'application/json'
try: try:
r = requests.post("https://the-phi.com/monitor/init/collector",headers=headers,data=json.dumps(SYS_ARGS)) url = "/".join([ENDPOINT,"init/collector"])
r = requests.post(url,headers=headers,data=json.dumps(SYS_ARGS))
r = json.loads(r.text) r = json.loads(r.text)
self.monitor = pickle.loads(r[0]) self.monitor = pickle.loads(r[0])

Loading…
Cancel
Save