commit
6dad5d9f4d
|
@ -65,6 +65,9 @@ class Container_Collector(threading.Thread):
|
|||
#if basic_exist:
|
||||
# logger.info(workercinfo[container_name]['basic_info'])
|
||||
if(info['State'] == 'STOPPED'):
|
||||
if not 'RunningTime' in basic_info.keys():
|
||||
basic_info['RunningTime'] = 0
|
||||
basic_info['LastTime'] = 0
|
||||
workercinfo[container_name]['basic_info'] = basic_info
|
||||
logger.info(basic_info)
|
||||
return False
|
||||
|
|
|
@ -121,7 +121,7 @@ class Worker(object):
|
|||
logger.info ("initialize rpcserver %s:%d" % (self.addr, int(self.port)))
|
||||
# logRequests=False : not print rpc log
|
||||
#self.rpcserver = xmlrpc.server.SimpleXMLRPCServer((self.addr, self.port), logRequests=False)
|
||||
self.rpcserver = ThreadXMLRPCServer((self.addr, int(self.port)), allow_none=True)
|
||||
self.rpcserver = ThreadXMLRPCServer((self.addr, int(self.port)), allow_none=True, logRequests=False)
|
||||
self.rpcserver.register_introspection_functions()
|
||||
self.rpcserver.register_instance(Containers)
|
||||
self.rpcserver.register_function(monitor.workerFetchInfo)
|
||||
|
|
|
@ -175,9 +175,6 @@ var host = window.location.host;
|
|||
var node_name = $("#node_name").html();
|
||||
var url = "http://" + host + "/monitor/vnodes/" + node_name;
|
||||
|
||||
plot_graph($("#mem-chart"),url + "/mem_use/",processMemData,getMemY);
|
||||
plot_graph($("#cpu-chart"),url + "/cpu_use/",processCpuData,getCpuY);
|
||||
|
||||
function processDiskData()
|
||||
{
|
||||
$.post(url+"/disk_use/",{},function(data){
|
||||
|
@ -212,3 +209,5 @@ function processBasicInfo()
|
|||
},"json");
|
||||
}
|
||||
setInterval(processBasicInfo,1000);
|
||||
plot_graph($("#mem-chart"),url + "/mem_use/",processMemData,getMemY);
|
||||
plot_graph($("#cpu-chart"),url + "/cpu_use/",processCpuData,getCpuY);
|
||||
|
|
|
@ -5,8 +5,11 @@ var idle = 0;
|
|||
var disk_usedp = 0;
|
||||
var count = 0;
|
||||
var Ki = 1024;
|
||||
var is_running = true;
|
||||
|
||||
function processMemData(data)
|
||||
{
|
||||
if(is_running)
|
||||
{
|
||||
used = data.monitor.meminfo.used;
|
||||
total = data.monitor.meminfo.total;
|
||||
|
@ -17,6 +20,14 @@ function processMemData(data)
|
|||
$("#mem_total").html(total2);
|
||||
$("#mem_free").html(free2);
|
||||
}
|
||||
else
|
||||
{
|
||||
total = 0;
|
||||
$("#mem_used").html("--");
|
||||
$("#mem_total").html("--");
|
||||
$("#mem_free").html("--");
|
||||
}
|
||||
}
|
||||
function getMemY()
|
||||
{
|
||||
if(total == 0)
|
||||
|
@ -25,6 +36,8 @@ function getMemY()
|
|||
return (used/total)*100;
|
||||
}
|
||||
function processCpuData(data)
|
||||
{
|
||||
if(is_running)
|
||||
{
|
||||
idle = data.monitor.cpuinfo.idle;
|
||||
var us = data.monitor.cpuinfo.user;
|
||||
|
@ -35,6 +48,15 @@ function processCpuData(data)
|
|||
$("#cpu_iowait").html(wa);
|
||||
$("#cpu_idle").html(idle);
|
||||
}
|
||||
else
|
||||
{
|
||||
idle = 100;
|
||||
$("#cpu_user").html("--");
|
||||
$("#cpu_system").html("--");
|
||||
$("#cpu_iowait").html("--");
|
||||
$("#cpu_idle").html("--");
|
||||
}
|
||||
}
|
||||
function getCpuY()
|
||||
{
|
||||
count++;
|
||||
|
@ -190,8 +212,20 @@ var host = window.location.host;
|
|||
var com_ip = $("#com_ip").html();
|
||||
var url = "http://" + host + "/monitor/hosts/"+com_ip;
|
||||
|
||||
function processStatus()
|
||||
{
|
||||
$.post(url+"/status/",{},function(data){
|
||||
var state = data.monitor.status;
|
||||
if(state == 'RUNNING')
|
||||
is_running = true;
|
||||
else
|
||||
is_running = false;
|
||||
},"json");
|
||||
}
|
||||
setInterval(processStatus,1000);
|
||||
|
||||
plot_graph($("#mem-chart"), url + "/meminfo/",processMemData,getMemY);
|
||||
plot_graph($("#cpu-chart"), url + "/cpuinfo/",processCpuData,getCpuY);
|
||||
//plot_graph($("#disk-chart"), url + "/diskinfo",processDiskData,getDiskY);
|
||||
$.post(url+"/diskinfo/",{user:"root",key:"unias"},processDiskData,"json");
|
||||
$.post(url+"/diskinfo/",{},processDiskData,"json");
|
||||
|
||||
|
|
|
@ -125,6 +125,17 @@
|
|||
{
|
||||
|
||||
$.post(url+"/basic_info/",{},function(data){
|
||||
|
||||
$.post(url+"/disk_use/",{},function(data){
|
||||
var diskuse = data.monitor.disk_use;
|
||||
var usedp = diskuse.percent;
|
||||
var total = diskuse.total/1024.0/1024.0;
|
||||
var used = diskuse.used/1024.0/1024.0;
|
||||
var detail = "("+used.toFixed(2)+"MiB/"+total.toFixed(2)+"MiB)";
|
||||
$("#"+index+"_disk").html(usedp+"%<br/>"+detail);
|
||||
},"json");
|
||||
$("#"+index+"_time").html(data.monitor.basic_info.RunningTime+"s")
|
||||
|
||||
var state = data.monitor.basic_info.State;
|
||||
if(state == 'RUNNING')
|
||||
{
|
||||
|
@ -147,7 +158,6 @@
|
|||
$("#"+index+"_mem").html('--');
|
||||
return;
|
||||
}
|
||||
$("#"+index+"_time").html(data.monitor.basic_info.RunningTime+"s")
|
||||
|
||||
$.post(url+"/cpu_use/",{},function(data){
|
||||
var usedp = data.monitor.cpu_use.usedp;
|
||||
|
@ -169,14 +179,6 @@
|
|||
$("#"+index+"_mem").html((usedp/0.01).toFixed(2)+"%<br/>"+out);
|
||||
},"json");
|
||||
|
||||
$.post(url+"/disk_use/",{},function(data){
|
||||
var diskuse = data.monitor.disk_use;
|
||||
var usedp = diskuse.percent;
|
||||
var total = diskuse.total/1024.0/1024.0;
|
||||
var used = diskuse.used/1024.0/1024.0;
|
||||
var detail = "("+used.toFixed(2)+"MiB/"+total.toFixed(2)+"MiB)";
|
||||
$("#"+index+"_disk").html(usedp+"%<br/>"+detail);
|
||||
},"json");
|
||||
},"json");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue