| 141 |
Kevin |
1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/loose.dtd">
|
|
|
3 |
|
|
|
4 |
<html lang="en">
|
|
|
5 |
<head>
|
|
|
6 |
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
|
7 |
|
|
|
8 |
<title>Sysstat Widgets Demo</title>
|
|
|
9 |
|
|
|
10 |
<!--
|
|
|
11 |
The widgets are <div> and <span> elements with classes memstat
|
|
|
12 |
and loadavg, respectively.
|
|
|
13 |
Change the 'url' attribute to point to your web service.
|
|
|
14 |
-->
|
|
|
15 |
<script language="javascript" type="text/javascript" src="sysstatwidgets.js">
|
|
|
16 |
</script>
|
|
|
17 |
<script type="text/javascript">
|
|
|
18 |
function send(url, rselector) {
|
|
|
19 |
var $ = jQuerySysStatWidget;
|
|
|
20 |
$.get(url, function (response) {
|
|
|
21 |
$(rselector).html(response);
|
|
|
22 |
});
|
|
|
23 |
}
|
|
|
24 |
</script>
|
|
|
25 |
</head>
|
|
|
26 |
|
|
|
27 |
<body>
|
|
|
28 |
<p>This page display two widgets that display the physical memory
|
|
|
29 |
usage and the overall CPU load average of the machine that runs your
|
|
|
30 |
web service. Examine the HTML to see how these 'widgets' are embedded
|
|
|
31 |
into the page. </p>
|
|
|
32 |
|
|
|
33 |
<p>
|
|
|
34 |
<script>var count = 0;</script>
|
|
|
35 |
<a href="#" onclick="javascript:send('/runloop', '#responsemsg');">Click here</a> to run a 15 second loop on this machine (which will result in an increase in the load average).
|
|
|
36 |
<span id="responsemsg"></span>
|
|
|
37 |
</p>
|
|
|
38 |
|
|
|
39 |
<p>
|
|
|
40 |
<a href="#" onclick="javascript:send('/allocanon', '#responsemsg2');">Click here</a> to force allocation of 64MB of physical
|
|
|
41 |
memory used as application (anonymous) memory.
|
|
|
42 |
<span id="responsemsg2"></span>
|
|
|
43 |
</p>
|
|
|
44 |
|
|
|
45 |
<p>
|
|
|
46 |
<a href="#" onclick="javascript:send('/freeanon', '#responsemsg3');">Click here</a> to force deallocation of last
|
|
|
47 |
chunk of allocated physical memory.
|
|
|
48 |
<span id="responsemsg3"></span>
|
|
|
49 |
</p>
|
|
|
50 |
|
|
|
51 |
<table>
|
|
|
52 |
<tr>
|
|
|
53 |
<th>Memory</th>
|
|
|
54 |
|
|
|
55 |
<th>CPU Load Average</th>
|
|
|
56 |
</tr>
|
|
|
57 |
|
|
|
58 |
<tr>
|
|
|
59 |
<td>
|
|
|
60 |
<div id="meminfo" url="http://ec2-107-20-99-126.compute-1.amazonaws.com:80" update="1000"
|
|
|
61 |
style="margin-top:20px; margin-left:20px; width:180px; height:400px;">
|
|
|
62 |
</div>
|
|
|
63 |
</td>
|
|
|
64 |
|
|
|
65 |
<td>
|
|
|
66 |
<div id="loadavg" url="http://ec2-107-20-99-126.compute-1.amazonaws.com:80" update="1000"
|
|
|
67 |
style="margin-top:20px; margin-left:20px; width:600px; height:400px;">
|
|
|
68 |
Loading, please wait...
|
|
|
69 |
</div>
|
|
|
70 |
</td>
|
|
|
71 |
</tr>
|
|
|
72 |
</table>
|
|
|
73 |
|
|
|
74 |
<p>A text-only version of the load average widget:
|
|
|
75 |
<span class="loadavg-text" url="http://ec2-107-20-99-126.compute-1.amazonaws.com:80" update="1000"
|
|
|
76 |
style="font-weight: bold">
|
|
|
77 |
</span>
|
|
|
78 |
</p>
|
|
|
79 |
</body>
|
|
|
80 |
</html>
|