Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jul 2003 14:58:41 +0300 (EEST)
From:      Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To:        David Loszewski <lists@bsdadmins.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Bandwidth Monitoring
Message-ID:  <20030716115841.079CA234@pm514-9.comsys.ntu-kpi.kiev.ua>
In-Reply-To: <1058279163.193.2.camel@hades.bsdadmins.net.lucky.freebsd.questions>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 Jul 2003 13:32:26 +0000 (UTC) in lucky.freebsd.questions, David Loszewski wrote:

> Say I have a 20GB Data Transfer limit per month, is there a way to
> monitor how much of that limit I've used up? MRTG doesn't seem to do the
> job.
> 

sysutils/ipa from the Ports Collection can do it.

I even can try to write ipa.conf (but didn't test it),
let 100, 200, 300 be IP Firewall rules which counts ingoing
traffic from ISP:

rule isp-ingoing {
    ipfw = 100 200 300
    info = Ingoing traffic from ISP
    maxchunk = 1G
# This allows to monitor traffic before limit 20G.
#    limit 10G {
#        byte_limit = 10G
#	zero_time = +M
#	reach {
#	    exec = /bin/echo "10G reached" | /usr/bin/mail admin
#	}
#	expire {
#	    expire_time = 0s
#	}
#    }
#
# This is 20G/month limit.
    limit 20G {
        byte_limit = 20G
	zero_time = +M
	reach {
	    exec = /sbin/ipfw add 10 deny all from me to my-isp
	    exec = /bin/echo "20G reached" | /usr/bin/mail admin
	}
	expire {
	    expire_time = +M
	    exec = /sbin/ipfw del 10
	    exec = /bin/echo "20G reached limit expired" | /usr/bin/mail admin
	}
	startup {
	    if_limit_is_reached {
	        exec = /sbin/ipfw add 10 deny all from me to my-isp
	    }
	}
    }
}

I didn't test this config and it can contain errors!

More information in IPA manual pages (also available on
http://ipa-system.sourceforge.net/).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030716115841.079CA234>