Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2003 10:05:13 +0800
From:      Eugene Grosbein <eugen@kuzbass.ru>
To:        Milan Obuch <milan.obuch@bluegrass.sk>, net@freebsd.org
Subject:   Re: unicast octets statistics
Message-ID:  <3F0CC9D9.80A1BD78@kuzbass.ru>
References:  <3F0BA58E.1F8888A2@kuzbass.ru> <20030709060958.GD69076@cell.sick.ru> <200307090853.31579.root@home.bluegrass.sk> <3F0BE1E5.6010201@he.iki.fi> <3F0BEA55.D7ABD657@kuzbass.ru> <20030709104614.GA4540@home.bluegrass.sk>

next in thread | previous in thread | raw e-mail | index | archive | help
Milan Obuch wrote:

> > ifInOctets counts broadcasts too.
> > I finished with ipfw2, thank you all.

> Maybe you could 'advertise' your solution :)

I use ipfw2 to count packets:

from any to any in recv ep0 mac $mymac any
and
from any to any out xmit ep0.

I know my router sends only unicast traffic to uplink
so the second rule is simple. Then I use dirty ;) but simple
script for net-snmp/pass_persist. Mrtg draws graphic of unicast
traffic, asking snmp agent for .1.3.6.1.4.1977.ifnumber.[12]

#!/bin/sh
# $Id: snmpifmon,v 1.1 2003/07/09 09:25:46 eugen Exp $
#
# Format: $MYMIB.ifnum.[12], 1 for input, 2 for output

MYMIB=.1.3.6.1.4.1977
OFS="$IFS"

while read command
do
  case $command in
  PING)
        echo PONG
        ;;
  get)
        read MIB
        case "$MIB" in
        $MYMIB*)
            IFS=.
            set $MIB
            IFS=$OFS
            shift 7
            if [ $# -eq 2 ]; then
              set `echo -n '0 '; ipfw show 4${1}${2} 2>/dev/null` 
              if [ -n "$4" ]; then
                echo $MIB
                echo integer
                echo $4
              else echo NONE
              fi
            else
              echo NONE
            fi
            ;;
        *)  echo NONE
            ;;
        esac
        ;;
  *)
        echo NONE
        ;;
  esac
done



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F0CC9D9.80A1BD78>