matrix utility apps: initial version
[keystone-demos/matrix-apps.git] / utility_stats / cgi-bin / stats.cgi
1 #!/bin/sh
3 echo Content-type: text/html
4 echo 
5 echo 
6 cat << EOM
7 <head>
8 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
9 <title>Keystone II Utility Application System Statistics</title>
10 <META HTTP-EQUIV="REFRESH" CONTENT="60">
11 </head>
12 <body>
13 <div id='wrapper'>
14 <div id='logo'><h1>System Statistics</h1></div>
15 <div id='header'>
16 <div id='menu'>
17 </div>
19 <div id='page'>
20 <div id='content'>
21 <hr><table cellpadding='6'><tr>
22 <td valign='center'><image src='apps/images/utilities-c66x.png'></td>
23 <td width='100%' align='justify'>
24 <h2>Statistics</h2><br>
25 <p class='Description'><b>Description:</b> This page displays system statistics like Memory and CPU usage. This page refreshes itself every 60 seconds.</p>
26 </td></tr></table><hr><br>
27 </div>
28 EOM
30 TMPFILE=`mktemp`
32 cat << TOPINFO1  
33 <div>
34 <h3>Memory & CPU Usage</h3>
35 <PRE>
36 TOPINFO1
38 top -bn1 > $TMPFILE
39 sed '1,10!d' $TMPFILE
41 cat << TOPINFO2 
42 </PRE>
43 </div><br>
44 TOPINFO2
46 cat << EOF
47 <hr>
48 <div style="clear: both;">&nbsp;</div>
49 </div>
50 <div id="footer">
51         <p id="legal">( c ) 2013 Texas Instruments Incorporated&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
52 </div>
53 </body>
54 </html>
55 EOF