Yes, vnStat looks very promising.

Sent from a mobile device.

Michael Keuter

> Am 27.01.2021 um 05:27 schrieb David Kerr <da...@kerr.net>:
> 
> 
> Lonnie,
>   That is very interesting, I would love to have that as part of astlinux.  
> We may be missing some dependencies, it says it needs libgd for the graphs.  
> But I would find the data it collects and shows more useful than what we have 
> with Netstat/darkstat today.
> 
> David.
> 
>> On Tue, Jan 26, 2021 at 9:56 PM Lonnie Abelbeck <li...@lonnie.abelbeck.com> 
>> wrote:
>> Hi David,
>> 
>> In upstream Buildroot there is a "vnStat" package.
>> 
>> Seems like exactly what you are after, uses sqlite for storage.
>> 
>> https://humdi.net/vnstat/
>> 
>> Might be a good addition to AstLinux.
>> 
>> Lonnie
>> 
>> 
>> 
>> > On Jan 26, 2021, at 4:26 PM, David Kerr <da...@kerr.net> wrote:
>> > 
>> > Here is what I have done so far. In the network init script I have added 
>> > the following...
>> > 
>> > echo $(date +%s.%3N; cat /sys/class/net/$EXTIF/statistics/rx_bytes; cat 
>> > /sys/class/net/$EXTIF/statistics/tx_bytes) "stop" >> 
>> > /var/log/$EXTIF-meter.txt
>> > 
>> > right before the ip link set dev $EXTIF down.  I did the same for EXT2IF 
>> > and a "start" log immediately after every place the EXTIF/EXT2IF is 
>> > brought up.
>> > 
>> > Then I added the following to crontabs...
>> > 
>> > 59 * * * * echo $(date +%s.%3N; cat 
>> > /sys/class/net/eth0/statistics/rx_bytes; cat 
>> > /sys/class/net/eth0/statistics/tx_bytes) "cron" >> /var/log/eth0-meter.txt
>> > 59 * * * * echo $(date +%s.%3N; cat 
>> > /sys/class/net/eth2/statistics/rx_bytes; cat 
>> > /sys/class/net/eth2/statistics/tx_bytes) "cron" >> /var/log/eth2-meter.txt
>> > 
>> > Is there a way to get $EXTxx variables in crontabs?
>> > 
>> > After rebooting and waiting for the big hand to point at the number 12, 
>> > here is my eth0 log...
>> > 
>> > pbx kd # cat log/eth0-meter.txt
>> > 1611696594.726 41916587023 8211080131 stop
>> > 1611696625.644 0 0 start
>> > 1611698340.940 832008278 51755144 cron
>> > 
>> > So now I think I can just gather all the data and I should be able to 
>> > create a script to read and sum things up... last hour, last day, last 
>> > week, last month, whatever.  Could probably import to excel for fancy 
>> > graphs.  But patience required, will have to wait a while before I have 
>> > enough data to play with.
>> > 
>> > I suppose I could do this for INTIF's as well.
>> > 
>> > David
>> > 
>> > 
>> > On Tue, Jan 26, 2021 at 12:42 PM Lonnie Abelbeck 
>> > <li...@lonnie.abelbeck.com> wrote:
>> > David,
>> > 
>> > If you are happy with Netstat/darkstat there is a way to save and reload 
>> > that data to persistent storage.  Years ago this caused issues, but may 
>> > work today, and with a rc.conf variable option to enable it.
>> > 
>> > Without looking, basically the darkstat.init needs to be tweaked.
>> > 
>> > Lonnie
>> > 
>> > 
>> > 
>> > 
>> > > On Jan 26, 2021, at 10:45 AM, David Kerr <da...@kerr.net> wrote:
>> > > 
>> > > ifconfig/ip -s probably reports closest to what the ISP is metering.
>> > > And I assume that is what Netstat/darkstat is measuring.  But the data
>> > > on that tab is reset every reboot. I assume the interface RX/TX bytes
>> > > are reset to zero on boot (and/or on taking the interface down/up).  I
>> > > would need to make sure to capture the values on shutdown... and maybe
>> > > at regular intervals.  Any suggestions on how to capture final values
>> > > as an interface is shutdown?
>> > > 
>> > > Measuring in iptables might provide more granularity, but may not map
>> > > as closely to the raw data comcast measure.
>> > > 
>> > > David
>> > > 
>> > > On Tue, Jan 26, 2021 at 10:57 AM Lonnie Abelbeck
>> > > <li...@lonnie.abelbeck.com> wrote:
>> > >> 
>> > >> 
>> > >> 
>> > >>> On Jan 26, 2021, at 8:29 AM, Michael Keuter <li...@mksolutions.info> 
>> > >>> wrote:
>> > >>> 
>> > >>> 
>> > >>> 
>> > >>>> Am 26.01.2021 um 15:08 schrieb David Kerr <da...@kerr.net>:
>> > >>>> 
>> > >>>> As some of you may be aware, Comcast / Xfinity are starting to impose
>> > >>>> monthly data caps on internet usage.  Where I live it is 1.2TB a
>> > >>>> month.  So I just received the dreaded "You have used 75% of your
>> > >>>> allowance" email.  Fortunately only 5 days from the end of the month,
>> > >>>> but looking back there are months that I have exceeded the cap.
>> > >>>> 
>> > >>>> Can I do anything in Astlinux to meter usage myself?  I would want to
>> > >>>> monitor raw traffic in and out on eth0, the totals would need to
>> > >>>> survive reboot, I would want to reset on the first of each month and
>> > >>>> maintain a history.  For extra credit... be able to identify high
>> > >>>> users on my internal network(s).
>> > >>>> 
>> > >>>> Any ideas?  Have any other gateways (like OpenWRT) tackled this?
>> > >>>> 
>> > >>>> Thanks
>> > >>>> David
>> > >>> 
>> > >>> Hi David,
>> > >>> 
>> > >>> most applications that I know use RRDtool (a Round-Robin-database to 
>> > >>> store data/measurements) as its basis, like Munin, Cacti, MRTG etc.
>> > >>> 
>> > >>> https://en.wikipedia.org/wiki/RRDtool
>> > >>> 
>> > >>> It is also available in BR2.
>> > >>> Years ago I had hacked myself a Munin node (client) for AstLinux, so 
>> > >>> data could fetched from a Munin server on Debian in my network from my 
>> > >>> AstLinux boxes. But it does not work anymore or I forgot about it. But 
>> > >>> it created nice progress graphicss for some parameters (CPU load, 
>> > >>> traffic, Asterisk calls, etc.).
>> > >>> 
>> > >>> Now since we're using SSDs instead CF cards it would be nice to have 
>> > >>> such application.
>> > >>> My 2 cts.
>> > >>> 
>> > >>> Michael
>> > >> 
>> > >> If we are mostly interesting in network info:
>> > >> 
>> > >> ip -s link show dev eth0
>> > >> --or--
>> > >> ifconfig eth0
>> > >> 
>> > >> provides network interface usage.  On shutdown and/or regular cron this 
>> > >> info would need to be saved to persistent storage along with the sample 
>> > >> date.
>> > >> 
>> > >> Though corner cases when the eth0 link goes down or a PPPoE ppp0 
>> > >> interface comes and goes can make pure interface monitoring less 
>> > >> accurate.
>> > >> 
>> > >> An AIF plugin could be added to do something similar, which would be 
>> > >> required if forwarded LAN -> WAN traffic was to be recorded.  Though 
>> > >> the matching WAN -> LAN traffic might be a little tricky.
>> > >> 
>> > >> Then the little matter of what the ISP says the data is vs. your actual 
>> > >> data.
>> > >> 
>> > >> Lonnie
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> 
>> > >> _______________________________________________
>> > >> Astlinux-users mailing list
>> > >> Astlinux-users@lists.sourceforge.net
>> > >> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>> > >> 
>> > >> Donations to support AstLinux are graciously accepted via PayPal to 
>> > >> pay...@krisk.org.
>> > > 
>> > > 
>> > > _______________________________________________
>> > > Astlinux-users mailing list
>> > > Astlinux-users@lists.sourceforge.net
>> > > https://lists.sourceforge.net/lists/listinfo/astlinux-users
>> > > 
>> > > Donations to support AstLinux are graciously accepted via PayPal to 
>> > > pay...@krisk.org.
>> > > 
>> > > 
>> > 
>> > 
>> > 
>> > _______________________________________________
>> > Astlinux-users mailing list
>> > Astlinux-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/astlinux-users
>> > 
>> > Donations to support AstLinux are graciously accepted via PayPal to 
>> > pay...@krisk.org.
>> > _______________________________________________
>> > Astlinux-users mailing list
>> > Astlinux-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/astlinux-users
>> > 
>> > Donations to support AstLinux are graciously accepted via PayPal to 
>> > pay...@krisk.org.
>> 
>> 
>> 
>> _______________________________________________
>> Astlinux-users mailing list
>> Astlinux-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>> 
>> Donations to support AstLinux are graciously accepted via PayPal to 
>> pay...@krisk.org.
> _______________________________________________
> Astlinux-users mailing list
> Astlinux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
> 
> Donations to support AstLinux are graciously accepted via PayPal to 
> pay...@krisk.org.
_______________________________________________
Astlinux-users mailing list
Astlinux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.

Reply via email to