Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
CPU usage:
Browse files Browse the repository at this point in the history
- strip output from newlines
- dont check too often
  • Loading branch information
sergey-dryabzhinsky committed Jun 22, 2013
1 parent 0ba5028 commit 719273a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lwp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def container_cpu_percent(name):

cmd = ["lxc-ps --name %s -- u | awk 'BEGIN{s=0.0}{s+=$4}END{print s}'" % name]
try:
out = subprocess.check_output(cmd, shell=True)
out = subprocess.check_output(cmd, shell=True).strip()
except:
return '0'
return out
Expand Down
6 changes: 5 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,12 @@ <h4><span class="label label-{{ td[container_status] }}">{{ status.status|capita
function refresh(){
refreshMemoryHost();
refreshCPUHost();
refreshUptimeHost();
}

function refreshMedium(){
refreshCpuContainers();
refreshMemoryContainers();
refreshUptimeHost();
}

function refreshLong(){
Expand All @@ -301,6 +304,7 @@ <h4><span class="label label-{{ td[container_status] }}">{{ status.status|capita
check_version();
{% if session.su == 'Yes' and containers == [] %}$('#createCT').modal('show');{% endif %}
window.setInterval('refresh()', 15*1000);
window.setInterval('refreshMedium()', 60*1000);
window.setInterval('refreshLong()', 300*1000);
});

Expand Down

0 comments on commit 719273a

Please sign in to comment.