1 |
37ca49b4
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
45d6ada5
|
Sjon Hortensius
|
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 |
37ca49b4
|
Scott Ullrich
|
*/
|
31 |
|
|
|
32 |
13d193c2
|
Scott Ullrich
|
/*
|
33 |
|
|
pfSense_BUILDER_BINARIES: /usr/bin/top
|
34 |
45d6ada5
|
Sjon Hortensius
|
pfSense_MODULE: system
|
35 |
13d193c2
|
Scott Ullrich
|
*/
|
36 |
|
|
|
37 |
a7e599e7
|
Scott Ullrich
|
##|+PRIV
|
38 |
7997ed44
|
Renato Botelho
|
##|*IDENT=page-diagnostics-system-activity
|
39 |
a7e599e7
|
Scott Ullrich
|
##|*NAME=Diagnostics: System Activity
|
40 |
|
|
##|*DESCR=Allows access to the 'Diagnostics: System Activity' page
|
41 |
7997ed44
|
Renato Botelho
|
##|*MATCH=diag_system_activity.php*
|
42 |
a7e599e7
|
Scott Ullrich
|
##|-PRIV
|
43 |
|
|
|
44 |
37ca49b4
|
Scott Ullrich
|
require("guiconfig.inc");
|
45 |
|
|
|
46 |
45d6ada5
|
Sjon Hortensius
|
$pgtitle = array(gettext("Diagnostics"),gettext("System Activity"));
|
47 |
37ca49b4
|
Scott Ullrich
|
|
48 |
|
|
if($_REQUEST['getactivity']) {
|
49 |
53bd1642
|
jim-p
|
$text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`;
|
50 |
37ca49b4
|
Scott Ullrich
|
echo $text;
|
51 |
|
|
exit;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
include("head.inc");
|
55 |
|
|
|
56 |
45d6ada5
|
Sjon Hortensius
|
if ($input_errors)
|
57 |
|
|
print_input_errors($input_errors);
|
58 |
|
|
|
59 |
37ca49b4
|
Scott Ullrich
|
?>
|
60 |
45d6ada5
|
Sjon Hortensius
|
<script>
|
61 |
|
|
function getcpuactivity() {
|
62 |
|
|
$.ajax(
|
63 |
|
|
'/diag_system_activity.php',
|
64 |
|
|
{
|
65 |
|
|
method: 'post',
|
66 |
|
|
data: {
|
67 |
|
|
getactivity: 'yes'
|
68 |
|
|
},
|
69 |
|
|
dataType: "html",
|
70 |
|
|
success: function (data) {
|
71 |
|
|
$('#xhrOutput').html(data);
|
72 |
|
|
},
|
73 |
|
|
}
|
74 |
|
|
);
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
events.push(function(){
|
78 |
|
|
setInterval('getcpuactivity()', 2500);
|
79 |
|
|
getcpuactivity();
|
80 |
|
|
});
|
81 |
37ca49b4
|
Scott Ullrich
|
</script>
|
82 |
45d6ada5
|
Sjon Hortensius
|
|
83 |
|
|
<div class="panel panel-default">
|
84 |
|
|
<div class="panel-heading"><?=gettext('CPU Activity')?></div>
|
85 |
|
|
<div class="panel panel-body">
|
86 |
|
|
<pre id="xhrOutput"><?=gettext("Gathering CPU activity, please wait...")?></pre>
|
87 |
|
|
</div>
|
88 |
f74c828f
|
Colin Fleming
|
</div>
|
89 |
45d6ada5
|
Sjon Hortensius
|
|
90 |
|
|
<?php include("foot.inc");
|