1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
diag_cpu_activity.php
|
5
|
Copyright (C) 2008-2009 Scott Ullrich
|
6
|
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
|
/*
|
31
|
pfSense_BUILDER_BINARIES: /usr/bin/top
|
32
|
pfSense_MODULE: system
|
33
|
*/
|
34
|
|
35
|
##|+PRIV
|
36
|
##|*IDENT=page-diagnostics-system-activity
|
37
|
##|*NAME=Diagnostics: System Activity
|
38
|
##|*DESCR=Allows access to the 'Diagnostics: System Activity' page
|
39
|
##|*MATCH=diag_system_activity.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
require("guiconfig.inc");
|
43
|
|
44
|
$pgtitle = gettext("Diagnostics: System Activity");
|
45
|
|
46
|
if($_REQUEST['getactivity']) {
|
47
|
$text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`;
|
48
|
echo $text;
|
49
|
exit;
|
50
|
}
|
51
|
|
52
|
include("head.inc");
|
53
|
|
54
|
?>
|
55
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
56
|
<?php include("fbegin.inc"); ?>
|
57
|
<script type="text/javascript">
|
58
|
//<![CDATA[
|
59
|
function getcpuactivity() {
|
60
|
scroll(0,0);
|
61
|
var url = "/diag_system_activity.php";
|
62
|
var pars = 'getactivity=yes';
|
63
|
jQuery.ajax(
|
64
|
url,
|
65
|
{
|
66
|
type: 'post',
|
67
|
data: pars,
|
68
|
complete: activitycallback
|
69
|
});
|
70
|
}
|
71
|
function activitycallback(transport) {
|
72
|
jQuery('#cpuactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
|
73
|
setTimeout('getcpuactivity()', 2500);
|
74
|
}
|
75
|
setTimeout('getcpuactivity()', 1000);
|
76
|
//]]>
|
77
|
</script>
|
78
|
<div id="maincontent">
|
79
|
<?php
|
80
|
if($savemsg) {
|
81
|
echo "<div id=\"savemsg\">";
|
82
|
print_info_box($savemsg);
|
83
|
echo "</div>";
|
84
|
}
|
85
|
if ($input_errors)
|
86
|
print_input_errors($input_errors);
|
87
|
?>
|
88
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag system activity">
|
89
|
<tr>
|
90
|
<td>
|
91
|
<table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
|
92
|
<tr>
|
93
|
<td align="center">
|
94
|
<table summary="results">
|
95
|
<tr><td>
|
96
|
<div id="cpuactivitydiv">
|
97
|
<?=gettext("Gathering CPU activity, please wait...");?>
|
98
|
</div>
|
99
|
</td></tr>
|
100
|
</table>
|
101
|
</td>
|
102
|
</tr>
|
103
|
</table>
|
104
|
</td>
|
105
|
</tr>
|
106
|
</table>
|
107
|
</div>
|
108
|
<?php include("fend.inc"); ?>
|
109
|
</body>
|
110
|
</html>
|