blob: 2437e09f471d509d6feef667f364c123050d5355 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Seconds * 1000 = value
var update_interval = 7000;
function updateMeters()
{
x_get_stats(stats);
window.setTimeout('updateMeters()', update_interval);
}
function stats(x) {
var values = x.split("|");
for(var val in values)
if(val == 'undefined')
return;
updateCPU(values[0]);
updateMemory(values[1]);
updateUptime(values[2]);
updateState(values[3]);
updateTemp(values[4]);
}
function updateMemory(x)
{
document.getElementById("memusagemeter").value = x + '%';
document.getElementById("memwidtha").style.width = x + 'px';
document.getElementById("memwidthb").style.width = (100 - x) + 'px';
}
function updateCPU(x)
{
document.getElementById("cpumeter").value = x + '%';
document.getElementById("cpuwidtha").style.width = x + 'px';
document.getElementById("cpuwidthb").style.width = (100 - x) + 'px';
}
function updateTemp(x)
{
if(document.getElementById("tempmeter") != null) {
document.getElementById("tempmeter").value = x + 'C';
document.getElementById("tempwidtha").style.width = x + 'px';
document.getElementById("tempwidthb").style.width = (100 - x) + 'px';
}
}
function updateUptime(x)
{
document.getElementById("uptime").value = x;
}
function updateState(x)
{
document.getElementById("pfstate").value = x;
}
window.setTimeout('updateMeters()', update_interval);
|