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
42dc887c
Commit
42dc887c
authored
Mar 25, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(netflow) add status command, don't resolve netstat info
parent
7645c83b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
netflow
src/etc/rc.d/netflow
+15
-2
No files found.
src/etc/rc.d/netflow
View file @
42dc887c
...
...
@@ -36,6 +36,8 @@ name=netflow
rcvar
=
netflow_enable
start_cmd
=
"
${
name
}
_start"
stop_cmd
=
"
${
name
}
_stop"
status_cmd
=
"
${
name
}
_status"
extra_commands
=
"status"
[
-z
"
$netflow_enable
"
]
&&
netflow_enable
=
"NO"
...
...
@@ -51,7 +53,7 @@ setup_interface()
fi
interface
=
$1
# determine (snmp) ifIndex
ifIndex
=
`
/usr/bin/netstat
-i
| /usr/bin/grep Link# | /usr/bin/grep
$interface
|
awk
'{print $3}'
| /usr/bin/sed
's/<Link#//g'
| /usr/bin/sed
's/>//g'
`
ifIndex
=
`
/usr/bin/netstat
-i
-n
| /usr/bin/grep Link# | /usr/bin/grep
$interface
|
awk
'{print $3}'
| /usr/bin/sed
's/<Link#//g'
| /usr/bin/sed
's/>//g'
`
if
[
"
$ifIndex
"
==
""
]
;
then
echo
"error : interface
$interface
not found"
return
...
...
@@ -101,11 +103,22 @@ netflow_stop()
fi
# cleanup netflow processes
for
netflow_node
in
`
ngctl list |
grep
netflow_ |
awk
'{print $2;}'
`
for
netflow_node
in
`
/usr/sbin/
ngctl list |
grep
netflow_ |
awk
'{print $2;}'
`
do
/usr/sbin/ngctl shutdown
$netflow_node
:
done
}
# netflow status
netflow_status
()
{
flows
=
`
/usr/sbin/ngctl list |
grep
netflow_ |
wc
-l
| /usr/bin/awk
'{print $1}'
`
if
[
$flows
-eq
0
]
;
then
echo
"netflow is not active"
else
echo
"netflow is active (flows :
$flows
)"
fi
}
load_rc_config
$name
run_rc_command
$1
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