Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 15 Nov 2018, 16:39
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
How to measure Internet usage for current session only?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [15 Posts]  
Author Message
Bushbuck

Joined: 25 Jan 2013
Posts: 180

PostPosted: Fri 02 Feb 2018, 05:07    Post subject:  How to measure Internet usage for current session only?
Subject description: Tahr64 6.0.5
 

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.

_________________
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
Back to top
View user's profile Send private message 
OscarTalks


Joined: 05 Feb 2012
Posts: 1824
Location: London, England

PostPosted: Fri 02 Feb 2018, 07:05    Post subject:  

Try looking in /var/local/sns
_________________
Oscar in England

Back to top
View user's profile Send private message 
Bushbuck

Joined: 25 Jan 2013
Posts: 180

PostPosted: Fri 02 Feb 2018, 07:31    Post subject:  

Thanks, OscarTalks.

I edited those, but it didn't update the UI. Maybe it's cached somewhere. Do you know what the display program in the status bar is called?

_________________
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
Back to top
View user's profile Send private message 
OscarTalks


Joined: 05 Feb 2012
Posts: 1824
Location: London, England

PostPosted: Fri 02 Feb 2018, 07:46    Post subject:  

The applet is called netmon_wce in recent Woof CE Puppies
In earlier puppies it was called network_tray
You probably have to restart something or maybe even reboot to see the numbers change if you edit the files. Someone else may know if the data is stored in some other location.

_________________
Oscar in England

Back to top
View user's profile Send private message 
drunkjedi


Joined: 24 May 2015
Posts: 897

PostPosted: Fri 02 Feb 2018, 08:20    Post subject:  

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.
Code:
vnstat --iflist

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:
Code:
 vnstat -u -i eth0

After vnstat has been running for awhile then it will be able to show your data count.

Query the network traffic:
Code:
vnstat -q

Viewing live network traffic usage:
Code:
vnstat -l

To find more options, use:
Code:
vnstat --help
Back to top
View user's profile Send private message 
Bushbuck

Joined: 25 Jan 2013
Posts: 180

PostPosted: Fri 02 Feb 2018, 09:55    Post subject:  

Ah, I wondered what netmon_wce was, OscarTalks.

I will try vnstat, drunkjedi.

Thanks.

_________________
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 4371
Location: King's Lynn, UK.

PostPosted: Fri 02 Feb 2018, 13:21    Post subject:  

@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. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

Back to top
View user's profile Send private message Visit poster's website 
jafadmin

Joined: 19 Mar 2009
Posts: 857

PostPosted: Sat 03 Feb 2018, 15:56    Post subject:  

Here is a script that will collect the numbers for your current boot session:
Code:

#!/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


This just collects the info. Incorporate the techniques into whatever kind of app you want to create ..
Back to top
View user's profile Send private message 
Bushbuck

Joined: 25 Jan 2013
Posts: 180

PostPosted: Sun 04 Feb 2018, 01:07    Post subject:  

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.

_________________
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12966
Location: Gatineau (Qc), Canada

PostPosted: Sun 04 Feb 2018, 02:32    Post subject:  

Hello, Bushbuck.

Doesn't your Internet Service Provider provide that kind of information? They should
since they are billing you for it!!! Mine has a page for "Internet consumption".

IHTH.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 4371
Location: King's Lynn, UK.

PostPosted: Sun 04 Feb 2018, 07:01    Post subject:  

Hi, Bushbuck.

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.


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.

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/details/TL-WN725N.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. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

Back to top
View user's profile Send private message Visit poster's website 
tallboy


Joined: 21 Sep 2010
Posts: 1053
Location: Oslo, Norway

PostPosted: Sun 04 Feb 2018, 13:44    Post subject:  

Quote:
Mine has a page for "Internet consumption".


Mine too.

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send private message 
Bushbuck

Joined: 25 Jan 2013
Posts: 180

PostPosted: Fri 09 Feb 2018, 21:52    Post subject:  

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.

_________________
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 4371
Location: King's Lynn, UK.

PostPosted: Sun 11 Feb 2018, 07:11    Post subject:  

@Bushbuck:-

Sometimes BitMeter's daemons don't start correctly.....especially the one for the web interface.

To fix this, run in the terminal

Code:
/etc/init.d/bitmeter restart


..... followed by 'Enter', which restarts BitMeter itself, followed by

Code:
/etc/init.d/bitmeterweb restart


.....(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. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

Back to top
View user's profile Send private message Visit poster's website 
Bushbuck

Joined: 25 Jan 2013
Posts: 180

PostPosted: Mon 12 Feb 2018, 01:01    Post subject:  

That's interesting.

I'll have a play with that, tomorrow. Off to bed for me (UK) though.

_________________
Xenial Puppy 64, Gigabyte motherboard, Intel i7 4770.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [15 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0759s ][ Queries: 14 (0.0121s) ][ GZIP on ]