bug fix and enabling support for various applications

master
Steve L. Nyemba 8 years ago
parent f3ed19aeaf
commit ecd3dffbc6

@ -53,9 +53,10 @@ def procs(id):
conf = HANDLERS[id]["config"]
r = {}
for key in conf:
handler.init(conf[key])
r[key] = handler.composite()
return json.dumps(r)
return json.dumps(r)
else:
return "[]"
pass
@ -65,4 +66,5 @@ def dashboard():
context = PARAMS['context']
return render_template('dashboard.html',context=context)
if __name__== '__main__':
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX=?RT'
app.run(host='0.0.0.0',debug=True,threaded=True)

@ -31,7 +31,7 @@ body {
padding:4px;
}
.grid .fa-check {color:green}
.grid .fa-times {color:maroon; font-size:14px; font-family:sans-serif; font-weight:lighter}
.grid .fa-times {color:maroon; }
.menu {
margin:4px;

@ -34,8 +34,6 @@ monitor.processes.render = function(label,data) {
var m = row.memory_usage >0
var c = row.cpu_usage > 0
var r = row.memory_available > 0
console.log([row.label,m,c,r])
console.log(row)
if ( r && c && m) {
row.status = status['running']
}else if (r && (!m || !c) ){
@ -51,7 +49,7 @@ monitor.processes.render = function(label,data) {
var options = {}
options.data = data
options.rowClass = function(item,index){return 'small'}
//options.rowClass = function(item,index){return 'small'}
options.autoload = true
options.fields = [{name:'label',type:'text',title:"Process",headercss:"small bold"},{name:"cpu_usage",type:"number",title:"CPU", headercss:"small bold"},{name:"memory_usage",type:"text",title:"Mem. Used",type:"number",headercss:"small bold"},{name:"memory_available",type:"number",title:"Mem. Avail",headercss:"small bold"},
{name:"status",type:"text",title:"Status",headercss:"small bold",align:"center"}

@ -130,12 +130,13 @@ class DetailProcess(Analysis):
Analysis.init(self)
self.names = names;
def evaluate(self,name) :
cmd = "ps -eo pmem,pcpu,vsize,comm|grep :app$"
cmd = "ps -eo pmem,pcpu,vsize,comm|grep :app"
handler = subprocess.Popen(cmd.replace(":app",name),shell=True,stdout=subprocess.PIPE)
ostream = handler.communicate()[0].split('\n')
ostream = [ row.split(' ') for row in ostream if row != '']
if len(ostream) == 0:
ostream = [['0','0','0',name]]
r = []
for row in ostream :

Loading…
Cancel
Save