Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
43120044
Commit
43120044
authored
9 years ago
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) refactor diag_pf_info.php
parent
b57f27cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
52 deletions
+65
-52
actions_filter.conf
src/opnsense/service/conf/actions.d/actions_filter.conf
+6
-0
diag_pf_info.php
src/www/diag_pf_info.php
+59
-52
No files found.
src/opnsense/service/conf/actions.d/actions_filter.conf
View file @
43120044
...
...
@@ -27,3 +27,9 @@ command:/usr/local/sbin/pftop
parameters
: -
w
200
-
b
-
o
%
s
-
v
%
s
%
s
type
:
script_output
message
:
request
pftop
statistics
[
diag
.
info
]
command
:/
usr
/
local
/
opnsense
/
scripts
/
filter
/
pfinfo
.
py
parameters
: %
s
type
:
script_output
message
:
request
pf
diagnostic
information
This diff is collapsed.
Click to expand it.
src/www/diag_pf_info.php
View file @
43120044
...
...
@@ -29,67 +29,74 @@
require_once
(
"guiconfig.inc"
);
$pgtitle
=
gettext
(
"Diagnostics: pfInfo"
);
if
(
$_REQUEST
[
'getactivity'
])
{
$text
=
`/sbin/pfctl -vvsi`
;
$text
.=
"<p/>"
;
$text
.=
`/sbin/pfctl -vvsm`
;
$text
.=
"<p/>"
;
$text
.=
`/sbin/pfctl -vvst`
;
$text
.=
"<p/>"
;
$text
.=
`/sbin/pfctl -vvsI`
;
echo
$text
;
exit
;
$data_tabs
=
array
(
"info"
,
"memory"
,
"timeouts"
,
"interfaces"
);
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
if
(
isset
(
$_POST
[
'getactivity'
]))
{
$diag
=
configd_run
(
"filter diag info json"
);
echo
$diag
;
}
exit
;
}
include
(
"head.inc"
);
?>
<body>
<?php
include
(
"fbegin.inc"
);
?>
<script
type=
"text/javascript"
>
jQuery
(
document
).
ready
(
function
()
{
setTimeout
(
'
getpfinfo()
'
,
500
);});
//
<!
[
CDATA
[
function
getpfinfo
()
{
jQuery
.
ajax
({
type
:
"
POST
"
,
url
:
"
/diag_pf_info.php
"
,
data
:
'
getactivity=yes
'
,
async
:
false
,
complete
:
activitycallback
});
}
function
activitycallback
(
transport
)
{
jQuery
(
'
#pfactivitydiv
'
).
html
(
'
<font face="Courier" size="2"><pre style="text-align:left;">
'
+
transport
.
responseText
+
'
<
\
/pre><
\
/font>
'
);
setTimeout
(
'
getpfinfo()
'
,
2000
);
}
//]]>
$
(
document
).
ready
(
function
()
{
function
getpfinfo
()
{
jQuery
.
ajax
({
type
:
"
post
"
,
url
:
"
/diag_pf_info.php
"
,
data
:
'
getactivity=yes
'
,
dataType
:
"
json
"
,
success
:
function
(
data
)
{
// push data into tabs
$
.
each
(
data
,
function
(
key
,
value
)
{
if
(
$
(
"
#data_
"
+
key
.
toLowerCase
()).
length
)
{
$
(
"
#data_
"
+
key
.
toLowerCase
()).
html
(
value
);
}
});
setTimeout
(
getpfinfo
,
2000
);
}
});
}
getpfinfo
();
});
</script>
<section
class=
"page-content-main"
>
<div
class=
"container-fluid col-xs-12 col-sm-10 col-md-9"
>
<div
class=
"row"
>
<section
class=
"col-xs-12"
>
<?php
if
(
$savemsg
)
{
echo
"<div id=
\"
savemsg
\"
>"
;
print_info_box
(
$savemsg
);
echo
"</div>"
;
}
if
(
isset
(
$input_errors
)
&&
count
(
$input_errors
)
>
0
)
print_input_errors
(
$input_errors
);
?>
<div
id=
"pfactivitydiv"
>
<?=
gettext
(
"Gathering PF information, please wait..."
);
?>
</div>
</section>
</div>
</div>
<div
class=
"container-fluid col-xs-12 col-sm-10 col-md-9"
>
<div
class=
"row"
>
<section
class=
"col-xs-12"
>
<ul
class=
"nav nav-tabs"
data-tabs=
"tabs"
id=
"maintabs"
>
<?php
foreach
(
$data_tabs
as
$i
=>
$tabname
)
:?>
<
li
<?=
$i
==
0
?
'class="active"'
:
''
;
?>
>
<a
data-toggle=
"tab"
href=
"#
<?=
$tabname
;
?>
"
id=
"
<?=
$tabname
;
?>
_tab"
>
<?=
ucfirst
(
$tabname
);
?>
</a>
</li>
<?php
endforeach
;
?>
</ul>
<div
class=
"tab-content content-box tab-content"
>
<?php
foreach
(
$data_tabs
as
$i
=>
$tabname
)
:?>
<
div
id
=
"<?=
$tabname
;?>"
class
="
tab
-
pane
fade
in
<?=
$i
==
0
?
'active'
:
''
;
?>
">
<div
class=
"container-fluid"
>
<pre
id=
"data_
<?=
$tabname
;
?>
"
class=
"pre-scrollable"
>
<?=
gettext
(
"Gathering PF information, please wait..."
);
?>
</pre>
</div>
</div>
<?php
endforeach
;
?>
</div>
</section>
</div>
</div>
</section>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment