fix trend line, and minor bug

master
Steve L. Nyemba 8 years ago
parent 3b5718c0f5
commit 9be4fe836e

@ -56,7 +56,7 @@ f.close()
#
#
from threading import Thread, RLock
p = {'uri':'http://localhost:5984','dbname':'monitor','uid':'logs','filename':'logs.JSON'}
p = {'uri':'http://dev.the-phi.com:5984','dbname':'monitor','uid':'logs','filename':'logs.JSON'}
factory = DataSourceFactory()
gWriter = factory.instance(type='CouchdbWriter',args=p)
gReader = factory.instance(type='CouchdbReader',args=p)

@ -2,6 +2,8 @@ body {
font-size:14px;
font-family:sans-serif;
font-weight:lighter;
padding:20px;
}
.small {
font-family:sans-serif;

@ -101,19 +101,28 @@ monitor.processes.trend.render = function (logs, key,label) {
]
conf.data.datasets = [ ]
var x_axis = []
var _x = {}
var _y = {}
var values = jx.utils.patterns.visitor(logs,function(item){
x = new Date(item.year,item.month-1,item.day,item.hour,item.minute)
y = item[key]
if (_x[x] == null ||(_x[x] == null && _y[y] == null)) {
_x[x] = 1
_y[y] = 1
x_axis.push(x)
console.log([x,y])
return {x:x,y:y}
} else {
return null
}
})
var serie = {label:label,data:values}
i = parseInt(Math.random() * (COLORS.length - 1))
serie.backgroundColor = 'transparent'
serie.borderColor = COLORS[i]
serie.borderColor = COLORS[10]
serie.borderWidth = 1
serie.type = 'line'
conf.data.datasets.push(serie)

@ -46,7 +46,7 @@
<div class="left menu-item small padding-2x margin-2x"><i class="fa fa-chevron-right"></i> Mem. Used</div>
<div class="left menu-item small padding-2x margin-2x"><i class="fa fa-chevron-right"></i> Mem. Avail</div>
</div>
<canvas id="trends_chart" class="small grid" height="92%">
<canvas id="trends_chart" class="small grid" height="150px">
</canvas>
</div>

@ -226,6 +226,7 @@ class Monitor (Thread):
r = self.handler.composite()
self.writer.write(label=label,row = r)
lock.release()
time.sleep(2)
self.prune()

@ -503,7 +503,7 @@ class CouchdbWriter(Couchdb,Writer):
@param row row to be written
"""
def write(self,**params):
print self.uid
document = self.dbase.get(self.uid)
label = params['label']
row = params['row']

Loading…
Cancel
Save