Project

General

Profile

Download (3.19 KB) Statistics
| Branch: | Tag: | Revision:
1 37ca49b4 Scott Ullrich
<?php
2
/* $Id$ */
3
/*
4 5f601060 Phil Davis
	diag_system_activity.php
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6 dd447bde Jim Thompson
7 5f601060 Phil Davis
	Copyright (C) 2008-2009 Scott Ullrich
8
	All rights reserved.
9 37ca49b4 Scott Ullrich
10 5f601060 Phil Davis
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12 37ca49b4 Scott Ullrich
13 5f601060 Phil Davis
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15 37ca49b4 Scott Ullrich
16 5f601060 Phil Davis
	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 37ca49b4 Scott Ullrich
20 5f601060 Phil Davis
	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
	pfSense_MODULE:	system
35
*/
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 f8ec8de4 Renato Botelho
$pgtitle = gettext("Diagnostics: System Activity");
47 37ca49b4 Scott Ullrich
48 5f601060 Phil Davis
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
?>
57
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
58 f74c828f Colin Fleming
<?php include("fbegin.inc"); ?>
59 37ca49b4 Scott Ullrich
<script type="text/javascript">
60 f74c828f Colin Fleming
//<![CDATA[
61 37ca49b4 Scott Ullrich
	function getcpuactivity() {
62 699737d9 Phil Davis
		scroll(0, 0);
63 7a97eaef Scott Ullrich
		var url = "/diag_system_activity.php";
64 37ca49b4 Scott Ullrich
		var pars = 'getactivity=yes';
65 ebfc87d6 Vinicius Coque
		jQuery.ajax(
66 37ca49b4 Scott Ullrich
			url,
67
			{
68 ebfc87d6 Vinicius Coque
				type: 'post',
69
				data: pars,
70
				complete: activitycallback
71 37ca49b4 Scott Ullrich
			});
72
	}
73
	function activitycallback(transport) {
74 6c07db48 Phil Davis
		jQuery('#cpuactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
75 f74c828f Colin Fleming
		setTimeout('getcpuactivity()', 2500);
76 37ca49b4 Scott Ullrich
	}
77 f74c828f Colin Fleming
	setTimeout('getcpuactivity()', 1000);
78
//]]>
79 37ca49b4 Scott Ullrich
</script>
80 f74c828f Colin Fleming
<div id="maincontent">
81 37ca49b4 Scott Ullrich
<?php
82 5f601060 Phil Davis
	if ($savemsg) {
83 f74c828f Colin Fleming
		echo "<div id=\"savemsg\">";
84 37ca49b4 Scott Ullrich
		print_info_box($savemsg);
85 5f601060 Phil Davis
		echo "</div>";
86 37ca49b4 Scott Ullrich
	}
87 5f601060 Phil Davis
	if ($input_errors) {
88 37ca49b4 Scott Ullrich
		print_input_errors($input_errors);
89 5f601060 Phil Davis
	}
90 37ca49b4 Scott Ullrich
?>
91 f74c828f Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag system activity">
92 5f601060 Phil Davis
	<tr>
93
		<td>
94
			<table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
95
				<tr>
96
					<td align="center">
97
						<table summary="results">
98
							<tr>
99
								<td>
100
									<div id="cpuactivitydiv">
101
										<?=gettext("Gathering CPU activity, please wait...");?>
102
									</div>
103
								</td>
104
							</tr>
105
						</table>
106
					</td>
107
				</tr>
108
			</table>
109
		</td>
110
	</tr>
111 37ca49b4 Scott Ullrich
</table>
112 f74c828f Colin Fleming
</div>
113 37ca49b4 Scott Ullrich
<?php include("fend.inc"); ?>
114
</body>
115
</html>