rc script ng_netflow

Jan 27, 2010 15:53


#!/bin/sh
#
#
# PROVIDE: ng_netflow
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#

. /etc/rc.subr

name="ng_netflow"
rcvar="ng_netflow_enable"
start_cmd="ng_netflow_start"

required_modules="netgraph ng_ether ng_ksocket ng_netflow"

ng_netflow_start()
{
if [ -n "$ng_netflow_interface" ]; then

ng_if=$ng_netflow_interface
ng_host=$ng_netflow_host
ng_port=$ng_netflow_port

ngctl -f- <<-SEQ
mkpeer ${ng_if}: netflow lower iface0
name ${ng_if}:lower netflow
connect ${ng_if}: netflow: upper out0
mkpeer netflow: ksocket export inet/dgram/udp
msg netflow:export connect inet/${ng_host}:${ng_port}
msg netflow: setconfig {iface=0 conf=7}
msg netflow: settimeouts { inactive = 10 active = 15 }
SEQ
fi
}

load_rc_config ${name}

ng_netflow_enable=${ng_netflow_enable:-"NO"}
ng_netflow_interface=${ng_netflow_interafce:-""}
ng_netflow_host=${ng_netflow_host:-"127.0.0.1"}
ng_netflow_port=${ng_netflow_port:-"9997"}

run_rc_command $@

freebsd

Previous post Next post
Up