|
|
|
@ -9,7 +9,7 @@ import requests
|
|
|
|
|
import pickle
|
|
|
|
|
import json
|
|
|
|
|
from threading import Thread, RLock
|
|
|
|
|
ENDPOINT="https://dev.the-phi.com/monitor"
|
|
|
|
|
ENDPOINT="https://the-phi.com/monitor"
|
|
|
|
|
class Collector(Thread) :
|
|
|
|
|
def __init__(self):
|
|
|
|
|
Thread.__init__(self)
|
|
|
|
@ -23,12 +23,13 @@ class Collector(Thread) :
|
|
|
|
|
for id in ['apps','folders']:
|
|
|
|
|
if id in SYS_ARGS :
|
|
|
|
|
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'
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
self.monitor = pickle.loads(r[0])
|
|
|
|
|