Commit 06dc8bb2 authored by Tristan Cavelier's avatar Tristan Cavelier

monitor: rename resources.cgi to resource-consumption.cgi

parent 9ba557ea
...@@ -100,12 +100,12 @@ download-only = true ...@@ -100,12 +100,12 @@ download-only = true
filename = logfile.cgi.in filename = logfile.cgi.in
mode = 0644 mode = 0644
[resources-cgi] [resource-consumption-cgi]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename} url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true download-only = true
#md5sum = #md5sum =
filename = resources.cgi.in filename = resource-consumption.cgi.in
mode = 0644 mode = 0644
[status-cgi] [status-cgi]
......
...@@ -196,11 +196,11 @@ context = ...@@ -196,11 +196,11 @@ context =
[log-folder-cgi] [log-folder-cgi]
log-folder = $${monitor-directory:log} log-folder = $${monitor-directory:log}
[deploy-resource-monitoring-cgi] [deploy-resource-consumption-monitoring-cgi]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${resources-cgi:location}/${resources-cgi:filename} template = ${resource-consumption-cgi:location}/${resource-consumption-cgi:filename}
rendered = $${monitor-directory:monitoring-cgi}/$${:filename} rendered = $${monitor-directory:monitoring-cgi}/$${:filename}
filename = resources.cgi filename = resource-consumption.cgi
mode = $${deploy-settings-cgi:mode} mode = $${deploy-settings-cgi:mode}
context = context =
key monitor_bin monitor-parameters:executable key monitor_bin monitor-parameters:executable
......
...@@ -44,7 +44,7 @@ if action: ...@@ -44,7 +44,7 @@ if action:
partition_user, date_scope) partition_user, date_scope)
result_dict['memory'] = db.getPartitionUsedMemoryAverage( result_dict['memory'] = db.getPartitionUsedMemoryAverage(
partition_user, date_scope) partition_user, date_scope)
print json.dumps(result_dict) print json.dumps(result_dict)
else: else:
print """<html><head> print """<html><head>
...@@ -82,17 +82,17 @@ else: ...@@ -82,17 +82,17 @@ else:
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
var send = false; var send = false;
autoRefresh(); autoRefresh();
function autoRefresh() { function autoRefresh() {
refresh(); refresh();
setTimeout(function(){ autoRefresh(); }, 60000); setTimeout(function(){ autoRefresh(); }, 60000);
} }
function refresh() { function refresh() {
if (send) { return} if (send) { return}
var dataPost = {'posting-script': "monitoring/resources.cgi", var dataPost = {'posting-script': "monitoring/resource-consumption.cgi",
action: "refresh"}; action: "refresh"};
send = true; send = true;
$("#msg").fadeIn(); $("#msg").fadeIn();
...@@ -109,15 +109,15 @@ $(document).ready(function () { ...@@ -109,15 +109,15 @@ $(document).ready(function () {
table2 += '<th class="tg-s6z2">CPU %</th><th class="tg-s6z2">CPU Time</th>'; table2 += '<th class="tg-s6z2">CPU %</th><th class="tg-s6z2">CPU Time</th>';
table2 += '<th class="tg-s6z2">Threads</th><th class="tg-s6z2">Memory Usage</th>'; table2 += '<th class="tg-s6z2">Threads</th><th class="tg-s6z2">Memory Usage</th>';
table2 += '<th class="tg-s6z2">Memory %</th></tr>'; table2 += '<th class="tg-s6z2">Memory %</th></tr>';
table1 = '<tr><th class="tg-s6z2">Process PID</th>'; table1 = '<tr><th class="tg-s6z2">Process PID</th>';
table1 += '<th class="tg-s6z2">CPU %</th><th class="tg-s6z2">CPU Time</th>'; table1 += '<th class="tg-s6z2">CPU %</th><th class="tg-s6z2">CPU Time</th>';
table1 += '<th class="tg-s6z2">Threads</th><th class="tg-s6z2">Memory Usage</th>'; table1 += '<th class="tg-s6z2">Threads</th><th class="tg-s6z2">Memory Usage</th>';
table1 += '<th class="tg-s6z2">Memory %</th></tr>'; table1 += '<th class="tg-s6z2">Memory %</th></tr>';
table3 = '<tr><th class="tg-s6z2">CPU Load Average %</th>'; table3 = '<tr><th class="tg-s6z2">CPU Load Average %</th>';
table3 += '<th class="tg-s6z2">Memory Consumption Average</th></tr>'; table3 += '<th class="tg-s6z2">Memory Consumption Average</th></tr>';
line2 = "<tr class='tg-4eph tg-s6z2'>" line2 = "<tr class='tg-4eph tg-s6z2'>"
line2 += "<td>" + result['status']['total_process'] + "</td>"; line2 += "<td>" + result['status']['total_process'] + "</td>";
line2 += "<td>" + result['status']['cpu_percent'] + "</td>"; line2 += "<td>" + result['status']['cpu_percent'] + "</td>";
...@@ -138,11 +138,11 @@ $(document).ready(function () { ...@@ -138,11 +138,11 @@ $(document).ready(function () {
line += "<td>" + consump[i][4] + "</td>"; line += "<td>" + consump[i][4] + "</td>";
line += "</tr>"; line += "</tr>";
} }
table3 += "<tr class='tg-4eph tg-s6z2'>" table3 += "<tr class='tg-4eph tg-s6z2'>"
table3 += "<td>" + result['cpu-load'] + "</td>"; table3 += "<td>" + result['cpu-load'] + "</td>";
table3 += "<td>" + result['memory'] + " Mb</td></tr></table>"; table3 += "<td>" + result['memory'] + " Mb</td></tr></table>";
$("#box3").html(table3); $("#box3").html(table3);
$("#box2").html(table2 + line2 + '</table>'); $("#box2").html(table2 + line2 + '</table>');
$("#box1").html(table1 + line + '</table>'); $("#box1").html(table1 + line + '</table>');
...@@ -155,11 +155,11 @@ $(document).ready(function () { ...@@ -155,11 +155,11 @@ $(document).ready(function () {
$("#msg").fadeOut(); $("#msg").fadeOut();
}); });
} }
$("#refresh").click(function() { $("#refresh").click(function() {
refresh(); refresh();
}); });
}); });
</script> </script>
</head><body> </head><body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment