net-snmp and mrtg question

Dan Nelson dnelson at allantgroup.com
Sun Apr 10 09:37:46 PDT 2005


In the last episode (Apr 10), Angelin Lalev said:
> I have FreeBSD router with two interfaces. Every interface has
> several networks. The basic configuration of snmpd and mrtg allow me
> to monitor the load only on per-interface basis, but I need to be
> able to monitor the traffic on each network separately. Is there a
> way to do it via net-snmp / mrtg? Are there orther tools with output
> similar to mrtg (prefferably the same), which can do this?

Try this.  Add some ipfw count rules, two per network you want to
monitor:

add 1000 count ip from any to network1/mask out
add 1001 count ip from network1/mask to any in

, create a shell script called /usr/local/bin/get-ipfw-stats:

#! /bin/sh
inrule=$1
outrule=$2
set -- $(ipfw show $inrule)
echo $3
set -- $(ipfw show $outrule)
echo $3
uptime
hostname

, and use this in your Target line in your mrtg config file:

Target[net1]: `/usr/local/bin/get-ipfw-stats 1000 1001`

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list