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