stats: fixed issue with missing /sys/fs in docker 1.9, using docker stats; login works
This commit is contained in:
		@@ -308,6 +308,7 @@ function showviz(vizpath, more) {
 | 
			
		||||
  res = "digraph {\n"+"  rankdir="+rankdir+";\n"+viz+"\n}";
 | 
			
		||||
  try {
 | 
			
		||||
    status(more?Viz(res)+more:Viz(res));
 | 
			
		||||
    stats();
 | 
			
		||||
    $('#main a > ellipse + text').attr('font-size', '12');
 | 
			
		||||
    $('#main a > ellipse + text + text')
 | 
			
		||||
      .attr('font-weight', 'bold')
 | 
			
		||||
@@ -349,29 +350,21 @@ function size(num) {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var oldoldstats = null;
 | 
			
		||||
var oldstats = null;
 | 
			
		||||
var laststats=null;
 | 
			
		||||
function stats(data) {
 | 
			
		||||
  console.log("->rcv stats");
 | 
			
		||||
  if (!data && oldstats && oldoldstats) {
 | 
			
		||||
    data = oldstats;
 | 
			
		||||
    oldstats = oldoldstats;
 | 
			
		||||
  }
 | 
			
		||||
  if (oldstats) for (name in data) {
 | 
			
		||||
    var s = data[name];
 | 
			
		||||
    var o = oldstats[name];
 | 
			
		||||
    if (!o|| !s) continue;
 | 
			
		||||
    $('#main text + text:contains("'+name+'") + text')
 | 
			
		||||
      .html('cpu: '
 | 
			
		||||
           +(Math.round((s.cpuacct.usage.data-o.cpuacct.usage.data)
 | 
			
		||||
             /(s.cpuacct.usage.date-o.cpuacct.usage.date)
 | 
			
		||||
             /100)
 | 
			
		||||
             /100)
 | 
			
		||||
           +'% mem: '
 | 
			
		||||
           +size(s.memory.usage_in_bytes.data));
 | 
			
		||||
  }
 | 
			
		||||
  oldoldstats = oldstats;
 | 
			
		||||
  oldstats = data;
 | 
			
		||||
  if (data)
 | 
			
		||||
    console.log("->rcv stats");
 | 
			
		||||
  else
 | 
			
		||||
    data=laststats;
 | 
			
		||||
  if (!data) return;
 | 
			
		||||
  var lines = data.split("\n");
 | 
			
		||||
  var head = lines.shift();
 | 
			
		||||
  lines.forEach(function(line) {
 | 
			
		||||
    if (!line) return;
 | 
			
		||||
    elements = line.split(/ +/);
 | 
			
		||||
    $('#main text + text:contains("'+elements[0]+'") + text')
 | 
			
		||||
      .html('cpu: '+elements[1]+' mem: '+elements[7]);
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function images(i) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user