Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active disk information including usage and partition info #39

Merged
merged 2 commits into from
Dec 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions static/jscn/supervisor.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function SwitchTab(head, sect) {
"memo-over-ttle": "memo-over-body",
"memo-phys-ttle": "memo-phys-body",
"memo-virt-ttle": "memo-virt-body",
},
"disk": {
"disk-usej-ttle": "disk-usej-body",
"disk-part-ttle": "disk-part-body",
}
};
for (indx in sectlist[sect]) {
Expand Down Expand Up @@ -85,6 +89,37 @@ async function OverviewGraphAJAX() {
function(data) {
let deadobjc = JSON.parse(data.deadobjc);
cpuquant = parseInt(deadobjc["cpuquant"]);
// Rendered DOM for every disk partition and setting stage for live updating
for (let indx in deadobjc["diousage"]) {
$("#disk-usej-body").append(
"<table class='ui fixed compact table' id='disk-usej-tabl-" + indx + "'>" + "<thead>" + "<tr>" +
"<th colspan='3'><h2 class='bodyfont' id='disk-usej-name-" + indx + "' style='color: #008080;'>" + indx + "</h2></th>" +
"<th><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-bstm-" + indx + "'>0</div><div class='label bodyfont'>BSTM</div></div></th>" +
"</tr>" + "</thead>" + "<tbody>" + "<tr>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-rdct-" + indx + "'>0</div><div class='label bodyfont'>RDCT</div></div></td>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-wrct-" + indx + "'>0</div><div class='label bodyfont'>WRCT</div></div></td>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-rdbt-" + indx + "'>0</div><div class='label bodyfont'>RDBT</div></div></td>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-wrbt-" + indx + "'>0</div><div class='label bodyfont'>WRBT</div></div></td>" +
"</tr>" + "<tr>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-rdtm-" + indx + "'>0</div><div class='label bodyfont'>RDTM</div></div></td>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-wrtm-" + indx + "'>0</div><div class='label bodyfont'>WRTM</div></div></td>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-rdmc-" + indx + "'>0</div><div class='label bodyfont'>RDMC</div></div></td>" +
"<td><div class='ui small horizontal statistic'><div class='value bodyfont' id='disk-usej-wrmc-" + indx + "'>0</div><div class='label bodyfont'>WRMC</div></div></td>" +
"</tr>" + "</tbody>" + "</table>"
);
}
// One-time rendering of disk partitions
for (let indx = 0; indx < deadobjc.diskpart.length; indx ++) {
$("#disk-part-body").append(
"<table class='ui definition fixed compact table'>" + "<tbody>" + "<tr>" + "<td rowspan='2' class='four wide'>" +
"<h1 class='bodyfont' style='margin: 0px; color: #008080;' id='disk-part-name-" + indx + "'>" + deadobjc.diskpart[indx]["device"] + "</h1>" +
"<pre style='margin: 0px;' id='disk-part-fsys-" + indx + "'>" + deadobjc.diskpart[indx]["fstype"] + "</pre>" + "</td>" +
"<td class='twelve wide'><div class='ui teal horizontal label'><code>MLOC</code></div><code id='disk-part-mloc-" + indx + "'>" + deadobjc.diskpart[indx]["mountpoint"] + "</code></td>" +
"</tr>" + "<tr>" + "<td class='rowspanned'></td>" +
"<td><div class='ui teal horizontal label'><code>OPTS</code></div><code id='disk-part-opts-" + indx + "'>" + deadobjc.diskpart[indx]["opts"] + "</code></td>" +
"</tr>" + "</tbody>" + "</table>"
)
}
for (let indx = 0; indx < cpuquant; indx++) {
$("#prcpgraf").append(
"<div class='teal padded card bodyfont'>" +
Expand Down Expand Up @@ -203,6 +238,20 @@ async function OverviewGraphAJAX() {
document.getElementById("memo-virt-used").innerText = liveobjc.swapinfo["used"];
document.getElementById("memo-virt-sine").innerText = liveobjc.swapinfo["sin"];
document.getElementById("memo-virt-sout").innerText = liveobjc.swapinfo["sout"];
// Disk usage body updater
for (let indx in liveobjc["diousage"]) {
//console.log("disk-usej-name-" + indx);
document.getElementById("disk-usej-name-" + indx).innerText = indx;
document.getElementById("disk-usej-bstm-" + indx).innerText = liveobjc["diousage"][indx]["busy_time"];
document.getElementById("disk-usej-rdct-" + indx).innerText = liveobjc["diousage"][indx]["read_count"];
document.getElementById("disk-usej-wrct-" + indx).innerText = liveobjc["diousage"][indx]["write_count"];
document.getElementById("disk-usej-rdbt-" + indx).innerText = liveobjc["diousage"][indx]["read_bytes"];
document.getElementById("disk-usej-wrbt-" + indx).innerText = liveobjc["diousage"][indx]["write_bytes"];
document.getElementById("disk-usej-rdtm-" + indx).innerText = liveobjc["diousage"][indx]["read_time"];
document.getElementById("disk-usej-wrtm-" + indx).innerText = liveobjc["diousage"][indx]["write_time"];
document.getElementById("disk-usej-rdmc-" + indx).innerText = liveobjc["diousage"][indx]["read_merged_count"];
document.getElementById("disk-usej-wrmc-" + indx).innerText = liveobjc["diousage"][indx]["write_merged_count"];
}
// Stream graphs to DOM Canvas elements
cpusgraf.streamTo(document.getElementById("cpusover"), 1000);
physgraf.streamTo(document.getElementById("physover"), 1000);
Expand Down
16 changes: 13 additions & 3 deletions templates/mainpytm.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ <h2 class="ui container center aligned icon header bodyfont" style="color: #00c0
</table>
</div>
</div>
<div class="ui container"><hr style="background-color: #cccccc; height: 2px; border: none; margin-bottom: 1.25%; margin-top: 2.5%"/></div>
<div class="ui container"><hr style="background-color: #cccccc; height: 2px; border: none; margin-bottom: 2.5%; margin-top: 2.5%"/></div>
<div class="ui container bodyfont">
<div class="ui top attached tabular menu bodyfont teal">
<a class="item" id="memo-head-ttle" style="font-weight: bold; color: #008080;">Memory</a>
Expand All @@ -167,7 +167,7 @@ <h2 class="ui container center aligned icon header bodyfont" style="color: #00c0
<div class="header bodyfont" style="color: #00c080;">Physical memory</div>
<div class="meta"><span id="phys-dedi-byte">0</span> bytes in use</div>
<div class="description">
<h1 class="bodyfont" style="font-style: italic;"><span id="phys-dedi-perc">0</span>%</h1>
<h1 class="bodyfont"><span id="phys-dedi-perc">0</span>%</h1>
<canvas id="phys-dedi-graf" style="width:100%; height:12.5vh;"></canvas>
</div>
</div>
Expand All @@ -177,7 +177,7 @@ <h1 class="bodyfont" style="font-style: italic;"><span id="phys-dedi-perc">0</sp
<div class="header bodyfont" style="color: #00c080;">Virtual memory</div>
<div class="meta"><span id="virt-dedi-byte">0</span> bytes in use</div>
<div class="description">
<h1 class="bodyfont" style="font-style: italic;"><span id="virt-dedi-perc">0</span>%</h1>
<h1 class="bodyfont"><span id="virt-dedi-perc">0</span>%</h1>
<canvas id="virt-dedi-graf" style="width:100%; height:12.5vh;"></canvas>
</div>
</div>
Expand Down Expand Up @@ -207,6 +207,16 @@ <h1 class="bodyfont" style="font-style: italic;"><span id="virt-dedi-perc">0</sp
</table>
</div>
</div>
<div class="ui container"><hr style="background-color: #cccccc; height: 2px; border: none; margin-bottom: 2.5%; margin-top: 2.5%"/></div>
<div class="ui container bodyfont">
<div class="ui top attached tabular menu bodyfont teal">
<a class="item" id="memo-head-ttle" style="font-weight: bold; color: #008080;">Disks</a>
<a class="active item" id="disk-usej-ttle" onclick="SwitchTab('disk-usej-ttle', 'disk');">Usage</a>
<a class="item" id="disk-part-ttle" onclick="SwitchTab('disk-part-ttle', 'disk');">Partitions</a>
</div>
<div class="ui bottom attached active tab segment" id="disk-usej-body"></div>
<div class="ui bottom attached tab segment" id="disk-part-body"></div>
</div>
<div class="ui tiny modal" id="restwarn">
<div class="header bodyfont cardinal" style="padding: 1.5%; background-color: #00c080; color: #ffffff;">Connect</div>
<div class="content" style="padding: 1.5%;">
Expand Down