1 |
37ca49b4
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
diag_cpu_activity.php
|
5 |
13d193c2
|
Scott Ullrich
|
Copyright (C) 2008-2009 Scott Ullrich
|
6 |
37ca49b4
|
Scott Ullrich
|
All rights reserved.
|
7 |
|
|
|
8 |
|
|
Redistribution and use in source and binary forms, with or without
|
9 |
|
|
modification, are permitted provided that the following conditions are met:
|
10 |
|
|
|
11 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
this list of conditions and the following disclaimer.
|
13 |
|
|
|
14 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
15 |
|
|
notice, this list of conditions and the following disclaimer in the
|
16 |
|
|
documentation and/or other materials provided with the distribution.
|
17 |
|
|
|
18 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
13d193c2
|
Scott Ullrich
|
/*
|
31 |
|
|
pfSense_BUILDER_BINARIES: /usr/bin/top
|
32 |
|
|
pfSense_MODULE: system
|
33 |
|
|
*/
|
34 |
|
|
|
35 |
a7e599e7
|
Scott Ullrich
|
##|+PRIV
|
36 |
|
|
##|*IDENT=page-diag-system-activity
|
37 |
|
|
##|*NAME=Diagnostics: System Activity
|
38 |
|
|
##|*DESCR=Allows access to the 'Diagnostics: System Activity' page
|
39 |
|
|
##|*MATCH=diag_system_activity*
|
40 |
|
|
##|-PRIV
|
41 |
|
|
|
42 |
37ca49b4
|
Scott Ullrich
|
require("guiconfig.inc");
|
43 |
|
|
|
44 |
|
|
$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
|
45 |
|
|
|
46 |
e679308c
|
Scott Ullrich
|
$pgtitle = "Diagnostics: System Activity";
|
47 |
37ca49b4
|
Scott Ullrich
|
|
48 |
|
|
if($_REQUEST['getactivity']) {
|
49 |
06231a7d
|
Scott Ullrich
|
$text = `/usr/bin/top -HS`;
|
50 |
37ca49b4
|
Scott Ullrich
|
echo $text;
|
51 |
|
|
exit;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
include("head.inc");
|
55 |
|
|
|
56 |
|
|
?>
|
57 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
58 |
|
|
|
59 |
|
|
<script type="text/javascript">
|
60 |
|
|
function getcpuactivity() {
|
61 |
|
|
scroll(0,0);
|
62 |
7a97eaef
|
Scott Ullrich
|
var url = "/diag_system_activity.php";
|
63 |
37ca49b4
|
Scott Ullrich
|
var pars = 'getactivity=yes';
|
64 |
|
|
var myAjax = new Ajax.Request(
|
65 |
|
|
url,
|
66 |
|
|
{
|
67 |
|
|
method: 'post',
|
68 |
|
|
parameters: pars,
|
69 |
|
|
onComplete: activitycallback
|
70 |
|
|
});
|
71 |
|
|
}
|
72 |
|
|
function activitycallback(transport) {
|
73 |
0418253b
|
Scott Ullrich
|
$('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>';
|
74 |
37ca49b4
|
Scott Ullrich
|
setTimeout('getcpuactivity()', 2500);
|
75 |
|
|
}
|
76 |
|
|
setTimeout('getcpuactivity()', 1000);
|
77 |
|
|
</script>
|
78 |
|
|
<div id='maincontent'>
|
79 |
|
|
<?php
|
80 |
|
|
include("fbegin.inc");
|
81 |
|
|
if(strstr($pfSversion, "1.2"))
|
82 |
|
|
echo "<p class=\"pgtitle\">{$pgtitle}</p>";
|
83 |
|
|
if($savemsg) {
|
84 |
|
|
echo "<div id='savemsg'>";
|
85 |
|
|
print_info_box($savemsg);
|
86 |
|
|
echo "</div>";
|
87 |
|
|
}
|
88 |
|
|
if ($input_errors)
|
89 |
|
|
print_input_errors($input_errors);
|
90 |
|
|
?>
|
91 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
92 |
|
|
<tr>
|
93 |
|
|
<td>
|
94 |
|
|
<table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
|
95 |
|
|
<tr>
|
96 |
|
|
<td>
|
97 |
0418253b
|
Scott Ullrich
|
<center>
|
98 |
|
|
<table>
|
99 |
|
|
<tr><td>
|
100 |
|
|
<div name='cpuactivitydiv' id='cpuactivitydiv'>
|
101 |
|
|
<b>Gathering CPU activity, please wait...
|
102 |
|
|
</div>
|
103 |
|
|
</td></tr>
|
104 |
|
|
</table>
|
105 |
37ca49b4
|
Scott Ullrich
|
</td>
|
106 |
|
|
</tr>
|
107 |
|
|
</table>
|
108 |
|
|
</div>
|
109 |
|
|
</td>
|
110 |
|
|
</tr>
|
111 |
|
|
</table>
|
112 |
|
|
</form>
|
113 |
|
|
<?php include("fend.inc"); ?>
|
114 |
|
|
</body>
|
115 |
|
|
</html>
|