fix ui and api minor bugs

master
Steve L. Nyemba 8 years ago
parent 6619c75e33
commit aed107107b

@ -50,13 +50,37 @@ atexit.register(ThreadManager.stop)
def procs(id):
try:
gReader = factory.instance(type=class_read,args=p)
d = gReader.read()
data = gReader.read()
ahandler = AnomalyDetection()
learn = {}
for row in data['learn'] :
label = row['label']
learn[label] = row
r = {}
for label in d :
for label in data :
if label not in ['learn'] :
index = len(d[label]) - 1
r[label] = d[label][index]
index = len(data[label]) - 1
row = data[label][index]
r[label] = row
#
# Let us determine if this is a normal operation or not
# We will update the status of the information ...
#
for row in r[label] :
if row['label'] in learn:
id = row['label']
px = ahandler.predict([row],learn[id])
if px :
px = px[0]
row['anomaly'] = px[1]==1
print row
#
# @TODO:
# Compile a report here that will be sent to the mailing list
#
if row['status'] == 'crash' :
print row['label'],' *** ',row['status']
#for row in r[label] :
#yo = ML.Extract(['status'],row)
#xo = ML.Extract(['cpu_usage','memory_usage'],row)
@ -64,6 +88,7 @@ def procs(id):
except Exception, e:
print e
r = []
return json.dumps(r)
"""

@ -86,7 +86,7 @@ input[type=text]:focus{
.info {
margin:4px;
width:40%;
width:43%;
}
@ -96,5 +96,5 @@ input[type=text]:focus{
.bad { color:maroon}
.good{ color:green}
.warning{color:orange}
.fa-warning, .warning{color:orange}
.number {font-size:42px; font-weight:lighter; padding:2px; margin:2px;}

@ -78,7 +78,12 @@ monitor.processes.render = function(label,data) {
var item = args.item
var id = jx.dom.get.value('latest_processes_label')
var app = item.label
monitor.processes.trend.init(id,app)
monitor.processes.trend.init(id, app)
if (item.anomaly == true) {
jx.dom.show('has_anomaly')
} else {
jx.dom.hide('has_anomaly')
}
}
options.autoload = true

@ -22,41 +22,17 @@
})
</script>
<body>
<div class="left small border" style="width:15%; height:90%">
<div class="menu">
<div class="menu-item"><i class="fa fa-chevron-right"></i> Predictions</div>
</div>
<div class="left small border" style="width:12%; height:90%">
<div id="menu" class="menu"></div>
</div>
<div class="left" style="padding:4px; width:80%; height:200px">
<div>
<div class="bold">Process Predictions</div>
<div class="small">Anomaly Detection</div>
</div>
<div class="left border" style="width:73%; height:85%"></div>
<div class="right" style="width:25%; padding:4px" align="center">
<div class="border" style="width:100%; height:40%;margin-bottom:4px;">
<div class="number">00</div>
<div class="small">F-Score</div>
</div>
<div class="left border width-half" style="height:40%;">
<div class="number">00</div>
<div class="small">Recall</div>
</div>
<div class="right border width-half" style="height:40%;">
<div class="number">00</div>
<div class="small">Precision</div>
</div>
</div>
</div>
<div class="left info ">
<div class="" style="text-transform:capitalize; ">
<div class="left bold">Monitoring
<span id="latest_processes_label" class=""></span>
</div>
<div class="right button border" style="margin-right:15px">Predict</div>
</div>
<div class = "border-right" style="padding:2px; margin:4px; height:170px">
@ -81,7 +57,8 @@
</div>
<div class="left info">
<div class="bold">CPU & Memory Usage Trend for <span id="trend_info" class=""></span>
<div class="bold" style="height:28px">CPU & Memory Usage Trend for <span id="trend_info" class=""></span>
<div id="has_anomaly" class="small"><i class="fa fa-warning" ></i> Anomaly Detected</div>
</div>
<div style="height:270px; margin-top:10px">

Loading…
Cancel
Save