How to measure Internet usage for current session only?
How to measure Internet usage for current session only?
Does anyone know which file these figures are stored in?
After I log out (from a fixed connection in Tahr64 6.0.5), and log back in again, I see a cumulative number.
It's useful for the per-month number to be cumulative, but I'd like the per-session to start from zero.
After I log out (from a fixed connection in Tahr64 6.0.5), and log back in again, I see a cumulative number.
It's useful for the per-month number to be cumulative, but I'd like the per-session to start from zero.
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
- OscarTalks
- Posts: 2196
- Joined: Mon 06 Feb 2012, 00:58
- Location: London, England
- OscarTalks
- Posts: 2196
- Joined: Mon 06 Feb 2012, 00:58
- Location: London, England
Maybe you could try vnstat command.
A year ago when I was on tight data limit, I used it in Fatdog to monitor my data usage.
It's a small command, in Fatdog I think it's already present, in your puppy I don't know, run vnstat in terminal to see if it is.
If not, install it from PPM.
After installing, run this command to see what interfaces are available.
on my computer it returns this;
Available interfaces: eth0 eth1 lo
Since I use eth0; in order to setup the database, I used this command:
After vnstat has been running for awhile then it will be able to show your data count.
Query the network traffic:
Viewing live network traffic usage:
To find more options, use:
A year ago when I was on tight data limit, I used it in Fatdog to monitor my data usage.
It's a small command, in Fatdog I think it's already present, in your puppy I don't know, run vnstat in terminal to see if it is.
If not, install it from PPM.
After installing, run this command to see what interfaces are available.
Code: Select all
vnstat --iflist
Available interfaces: eth0 eth1 lo
Since I use eth0; in order to setup the database, I used this command:
Code: Select all
vnstat -u -i eth0
Query the network traffic:
Code: Select all
vnstat -q
Code: Select all
vnstat -l
Code: Select all
vnstat --help
- Mike Walsh
- Posts: 6351
- Joined: Sat 28 Jun 2014, 12:42
- Location: King's Lynn, UK.
@Bushbuck:-
If you want a GUI solution for keeping tabs on your internet usage (for whatever reason), have a look here:-
http://www.murga-linux.com/puppy/viewtopic.php?t=99025
BitMeterOS gives you a GUI which is accessible via a tab in your browser.....which is what runs up most of your data usage in the normal course of things.
You get a running total by the month, and a daily usage readout, too.
Mike.
If you want a GUI solution for keeping tabs on your internet usage (for whatever reason), have a look here:-
http://www.murga-linux.com/puppy/viewtopic.php?t=99025
BitMeterOS gives you a GUI which is accessible via a tab in your browser.....which is what runs up most of your data usage in the normal course of things.
You get a running total by the month, and a daily usage readout, too.
Mike.
Here is a script that will collect the numbers for your current boot session:
This just collects the info. Incorporate the techniques into whatever kind of app you want to create ..
Code: Select all
#!/bin/bash
# A script to get session network bytes from the
# linked NIC
#
MyName=$(echo $0 | rev | cut -d '/' -f1 | rev)
## Turn up the nics
NICList=$(ifconfig -a | grep -i ethernet | cut -b 1-6 | tr -d ' ')
for NicDEV in $NICList; do
ifconfig $NicDEV up 2>&1
done
sleep 5 # allow nics to settle
# get the "linked" nic
NICINFO=$(ifconfig -a | grep -B2 -i "broadcast running" )
NIC=$(echo $NICINFO | grep -i "ethernet" | cut -d ' ' -f1)
RXBytes=$(cat /sys/class/net/$NIC/statistics/rx_bytes)
RXPackets=$(cat /sys/class/net/$NIC/statistics/rx_packets)
TXBytes=$(cat /sys/class/net/$NIC/statistics/tx_bytes)
TXPackets=$(cat /sys/class/net/$NIC/statistics/tx_packets)
TotalBytes=$(( RXBytes + TXBytes ))
TotalPackets=$(( RXPackets + TXPackets ))
# Display the results ..
echo
echo " RX bytes = "$RXBytes
echo " TX bytes = "$TXBytes
echo " Total bytes = "$TotalBytes
echo
echo " RX packets = "$RXPackets
echo " TX packets = "$TXPackets
echo " Total packets = "$TotalPackets
echo
# Done
Interesting stuff from jafadmin and Mike. I will try them.
I've just got a wired broadband connection (replacing a 3G dongle). I ought to be able to use Xenial Puppy now ( ...or the latest Slacko - decisions eh?)
The old dongle didn't work with either of them.
I've just got a wired broadband connection (replacing a 3G dongle). I ought to be able to use Xenial Puppy now ( ...or the latest Slacko - decisions eh?)
The old dongle didn't work with either of them.
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
- Mike Walsh
- Posts: 6351
- Joined: Sat 28 Jun 2014, 12:42
- Location: King's Lynn, UK.
Hi, Bushbuck.
If you want a stable version, use the older 0.7.6; 0.8.0 is a bit buggy, since the author switched to a newer type of SQL database for that release.....and it didn't work out as well as he would have hoped.
Strangely enough, the .deb packages actually seem to work better than the .pet packages Geoffrey built for it; don't ask me why, I don't know. All I do know is that I've had 0.7.6 up-and-running in one or two of my Pups for over 2 years now (where I haven't re-installed them, that is).....and it's as stable as a rock.
----------------------------------------------------
Two dongles I've found work perfectly with pretty well all Pups are these:-
1 ) The TP-Link WN-725N
http://www.tp-link.com/uk/products/deta ... N725N.html
Uses the r8188eu module; if your Pup doesn't have it built-in, rcrsn51 has a whole bunch of driver .pets for it, here:-
http://www.murga-linux.com/puppy/viewtopic.php?t=107047
2 ) The NetGear WNA-3100M
https://www.netgear.com/support/product/WNA3100M.aspx
Uses the old faithful rtl8192cu driver, which seems to have been in the kernel forever. Again, if not built-in, or working correctly (older kernel variants were known for being a bit 'iffy', apparently), Bill's done a bunch of .pets for it, here:-
http://www.murga-linux.com/puppy/viewtopic.php?t=100675
Hope some of that helps. I can thoroughly recommend either of these, having used both for quite some time now. Neither of them will break the bank, being quite reasonably-priced. Dongles are like anything; you get what you pay for.....I wouldn't recommend some of the el cheapo jobs from the Far East for that very reason. Invariably, they'll only work with Windows, and using ndiswrapper doesn't always produce the results one would wish for!
Mike.
You should find BitMeterOS will work for you. It worked in just about every Puppy we tried it in.....and that was quite a few.Bushbuck wrote:Interesting stuff from jafadmin and Mike. I will try them.
I've just got a wired broadband connection (replacing a 3G dongle). I ought to be able to use Xenial Puppy now ( ...or the latest Slacko - decisions eh?)
The old dongle didn't work with either of them.
If you want a stable version, use the older 0.7.6; 0.8.0 is a bit buggy, since the author switched to a newer type of SQL database for that release.....and it didn't work out as well as he would have hoped.
Strangely enough, the .deb packages actually seem to work better than the .pet packages Geoffrey built for it; don't ask me why, I don't know. All I do know is that I've had 0.7.6 up-and-running in one or two of my Pups for over 2 years now (where I haven't re-installed them, that is).....and it's as stable as a rock.
----------------------------------------------------
Two dongles I've found work perfectly with pretty well all Pups are these:-
1 ) The TP-Link WN-725N
http://www.tp-link.com/uk/products/deta ... N725N.html
Uses the r8188eu module; if your Pup doesn't have it built-in, rcrsn51 has a whole bunch of driver .pets for it, here:-
http://www.murga-linux.com/puppy/viewtopic.php?t=107047
2 ) The NetGear WNA-3100M
https://www.netgear.com/support/product/WNA3100M.aspx
Uses the old faithful rtl8192cu driver, which seems to have been in the kernel forever. Again, if not built-in, or working correctly (older kernel variants were known for being a bit 'iffy', apparently), Bill's done a bunch of .pets for it, here:-
http://www.murga-linux.com/puppy/viewtopic.php?t=100675
Hope some of that helps. I can thoroughly recommend either of these, having used both for quite some time now. Neither of them will break the bank, being quite reasonably-priced. Dongles are like anything; you get what you pay for.....I wouldn't recommend some of the el cheapo jobs from the Far East for that very reason. Invariably, they'll only work with Windows, and using ndiswrapper doesn't always produce the results one would wish for!
Mike.
Just noticed that re-booting zeroed the byte counts for both the session and the month.
Thanks for the help.
The script gets the usage numbers for the etho connection. BitMeterOS installed, but didn't seem to do anything when I ran it.
The BT "usage" page says it is unlimited, but doesn't show any usage figures.
Thanks for the help.
The script gets the usage numbers for the etho connection. BitMeterOS installed, but didn't seem to do anything when I ran it.
The BT "usage" page says it is unlimited, but doesn't show any usage figures.
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
- Mike Walsh
- Posts: 6351
- Joined: Sat 28 Jun 2014, 12:42
- Location: King's Lynn, UK.
@Bushbuck:-
Sometimes BitMeter's daemons don't start correctly.....especially the one for the web interface.
To fix this, run in the terminal
..... followed by 'Enter', which restarts BitMeter itself, followed by
.....(and 'Enter'), which will restart the web interface. Then refresh the tab you've got showing BitMeterOS; all things being equal, it should now show an updating running total. It updates once every 10 seconds or so.
Let me know if that helps, please. One way to check whether BitMeter's running is to open /var/lib/bitmeter with ROX; if the daemon is running, you should see the word '(Scanning)' appear briefly every few seconds in the window title-bar.
Mike.
Sometimes BitMeter's daemons don't start correctly.....especially the one for the web interface.
To fix this, run in the terminal
Code: Select all
/etc/init.d/bitmeter restart
Code: Select all
/etc/init.d/bitmeterweb restart
Let me know if that helps, please. One way to check whether BitMeter's running is to open /var/lib/bitmeter with ROX; if the daemon is running, you should see the word '(Scanning)' appear briefly every few seconds in the window title-bar.
Mike.