|
|
@ -52,7 +52,6 @@ f.close()
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
from threading import Thread, RLock
|
|
|
|
from threading import Thread, RLock
|
|
|
|
p = {'uri':'http://dev.the-phi.com:5984','dbname':'monitor','uid':'logs','filename':'logs.JSON'}
|
|
|
|
|
|
|
|
p = CONFIG['store']['args']
|
|
|
|
p = CONFIG['store']['args']
|
|
|
|
class_read = CONFIG['store']['class']['read']
|
|
|
|
class_read = CONFIG['store']['class']['read']
|
|
|
|
class_write= CONFIG['store']['class']['write']
|
|
|
|
class_write= CONFIG['store']['class']['write']
|
|
|
@ -132,6 +131,27 @@ def requirements():
|
|
|
|
def dashboard():
|
|
|
|
def dashboard():
|
|
|
|
context = PARAMS['context']
|
|
|
|
context = PARAMS['context']
|
|
|
|
return render_template('dashboard.html',context=context)
|
|
|
|
return render_template('dashboard.html',context=context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
This function is designed to trigger learning for anomaly detection
|
|
|
|
|
|
|
|
@TODO: forward this to a socket i.e non-blocking socket
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
@app.route('/learn')
|
|
|
|
|
|
|
|
def learn():
|
|
|
|
|
|
|
|
app = request.args.get('app')
|
|
|
|
|
|
|
|
id = request.args.get('id')
|
|
|
|
|
|
|
|
p = CONFIG['store']['args']
|
|
|
|
|
|
|
|
class_read = CONFIG['store']['class']['read']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p['qid'] =[id] #HANDLERS['processes']['config'].keys()
|
|
|
|
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r = gReader.read()
|
|
|
|
|
|
|
|
r = r[id]
|
|
|
|
|
|
|
|
r = ML.Filter('label',app,r)
|
|
|
|
|
|
|
|
label = ML.Extract(['status'],r)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__== '__main__':
|
|
|
|
if __name__== '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
mthread.start()
|
|
|
|
mthread.start()
|
|
|
|