Project

General

Profile

Download (4.32 KB) Statistics
| Branch: | Tag: | Revision:
1 14f84bc9 Scott Ullrich
<?php
2
/* $Id$ */
3
/*
4 83c56e9c Scott Ullrich
    diag_system_pftop.php
5 13d193c2 Scott Ullrich
    Copyright (C) 2008-2009 Scott Ullrich
6 14f84bc9 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_MODULE:	filter
32
*/
33
34 14f84bc9 Scott Ullrich
##|+PRIV
35
##|*IDENT=page-diag-system-activity
36
##|*NAME=Diagnostics: System Activity
37
##|*DESCR=Allows access to the 'Diagnostics: System Activity' page
38 fce938b3 jim-p
##|*MATCH=diag_system_pftop.php*
39 14f84bc9 Scott Ullrich
##|-PRIV
40
41
require("guiconfig.inc");
42
43
$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
44
45 a1054b46 Scott Ullrich
$pgtitle = gettext("Diagnostics: pfTop");
46 14f84bc9 Scott Ullrich
47
if($_REQUEST['getactivity']) {
48
	if($_REQUEST['sorttype'])
49
		$sorttype = escapeshellarg($_REQUEST['sorttype']);
50
	else
51 e6c074f9 Carlos Eduardo Ramos
		$sorttype = gettext("bytes");	
52 14f84bc9 Scott Ullrich
	$text = `pftop -b -a -o {$sorttype}`;
53
	echo $text;
54
	exit;
55
}
56
57
include("head.inc");
58
59
if($_REQUEST['sorttype'])
60
	$sorttype = htmlentities($_REQUEST['sorttype']);
61
else
62 e6c074f9 Carlos Eduardo Ramos
	$sorttype = gettext("bytes");
63 14f84bc9 Scott Ullrich
64
?>
65
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
66 6a594976 Scott Ullrich
<form method="post" action="diag_system_pftop.php">
67 14f84bc9 Scott Ullrich
<script type="text/javascript">
68
	function getcpuactivity() {
69
		var url = "/diag_system_pftop.php";
70 ebfc87d6 Vinicius Coque
		var pars = 'getactivity=yes&sorttype=' + jQuery('#sorttype').val();
71
		jQuery.ajax(
72 14f84bc9 Scott Ullrich
			url,
73
			{
74 ebfc87d6 Vinicius Coque
				type: 'post',
75
				data: pars,
76
				complete: activitycallback
77 14f84bc9 Scott Ullrich
			});
78
	}
79
	function activitycallback(transport) {
80 ebfc87d6 Vinicius Coque
		jQuery('#cpuactivitydiv').html('<font face="Courier"><font size="2"><b><pre style="text-align:left;">' + transport.responseText  + '</pre></font>');
81 14f84bc9 Scott Ullrich
		setTimeout('getcpuactivity()', 2500);		
82
	}
83
	setTimeout('getcpuactivity()', 1000);	
84
</script>
85
<div id='maincontent'>
86
<?php
87
	include("fbegin.inc"); 
88
	if(strstr($pfSversion, "1.2")) 
89
		echo "<p class=\"pgtitle\">{$pgtitle}</p>";
90
	if($savemsg) {
91
		echo "<div id='savemsg'>";
92
		print_info_box($savemsg);
93
		echo "</div>";	
94
	}
95
	if ($input_errors)
96
		print_input_errors($input_errors);
97
?>
98
	<form method="post">
99 c0948c6c Renato Botelho
	<?=gettext("Sort type:"); ?>
100 14f84bc9 Scott Ullrich
	<select name='sorttype' id='sorttype' onChange='this.form.submit();'>
101
		<option value='<?=$sorttype?>'><?=$sorttype?></option>
102 f8ec8de4 Renato Botelho
		<option value='age'><?=gettext("age");?></option>
103
		<option value='bytes'><?=gettext("bytes");?></option>
104
		<option value='dest'><?=gettext("dest");?></option>
105
		<option value='dport'><?=gettext("dport");?></option>
106
		<option value='exp'><?=gettext("exp");?></option>
107
		<option value='none'><?=gettext("none");?></option>
108
		<option value='peak'><?=gettext("peak");?></option>
109
		<option value='pkt'><?=gettext("pkt");?></option>
110
		<option value='rate'><?=gettext("rate");?></option>
111
		<option value='size'><?=gettext("size");?></option>
112
		<option value='sport'><?=gettext("sport");?></option>
113
		<option value='src'><?=gettext("src");?></option>														
114 14f84bc9 Scott Ullrich
	</select>
115 fd68d052 Scott Ullrich
	<p/>
116 14f84bc9 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">  
117
  <tr>
118
    <td>
119
	<table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
120
		<tr>
121
			<td>
122
				<center>
123
				<table>
124
					<tr><td>
125
						<div name='cpuactivitydiv' id='cpuactivitydiv'>
126 f8ec8de4 Renato Botelho
							<b><?=gettext("Gathering pfTOP activity, please wait...");?>
127 14f84bc9 Scott Ullrich
						</div>
128
					</td></tr>
129
				</table>
130
			</td>
131
		</tr>
132
	</table>
133
	</div>
134
    </td>
135
  </tr>
136
</table>
137
</form>
138
<?php include("fend.inc"); ?>
139
</body>
140
</html>