BIT METER OS 0.7.6 (stable) & 0.8.0 (experimental)

Configuration wizards, scanners, remote desktop, etc.
Post Reply
Message
Author
User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#91 Post by Mike Walsh »

Hello, David.

Now; let's see if I have this right. As I understand it, BitMeter (I can't vouch for other monitors, as I haven't tried any others...yet!), stores its data in a database called 'bitmeter.db' in /var/lib.

By using the address bar entry 'localhost:2605/index.html', you are then telling the local loopback system to listen, on port 2605, for the most recent measurement from BitMeter, as it is in fact a small 'server'. The app itself is fairly configurable; you can set the 'Summary' tab to refresh itself at any interval you like, right down to once a second if you want. I have mine set for once every 7 seconds.....the default is 10.

I haven't got a clue whether other monitors work in this fashion.....I only know that this is how BitMeter OS works. Now that the author, Rob Dawson, has posted in the thread, you may be able to get a more detailed answer from the man himself. He's indicated that he's quite willing to answer questions on the subject.


Regards,

Mike.

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#92 Post by Geoffrey »

mikeb wrote:pcap...some don't have it at all ..some need a link...some have the link...a mixed bag. My thoughts were to include a copy of 0.8 as its small... make it independent of whatever system its on then.
Is there a particular pcap that's needed, the one in Vanguard is as in Carolina/wary, if that will do I can add that so it's only used if the native version doesn't exist.

Could likely have the pinstall also create new bitmeterweb and bimeter scripts to suit the versions of puppy that don't support the debian one's.

So far I'm at this as a pinstall if I add the Carolina libpcap.so.0.8 @179.1 kB, is there a smaller one ?

Code: Select all

LIBPCAP=`find /usr -type f -name 'libpcap.so.*' | head -n 1`
if [ ! -f "$LIBPCAP" ]; then
cp libpcap.so.0.8 /usr/lib/
else
LINK_PATH=${LIBPCAP%/*}
if [ ! -f "$LINK_PATH/libpcap.so.0.8" ]; then
ln -s "$LIBPCAP" "$LINK_PATH"/libpcap.so.0.8
fi;fi
cp /var/lib/bitmeter/bitmeter.db.new /var/lib/bitmeter/bitmeter.db
/etc/init.d/bitmeterweb start 
/etc/init.d/bitmeter start 
exit 0
How would this be as a start, stop script ?

Code: Select all

#!/bin/sh
# Lucid/412
DAEMON=/usr/bin/bmcapture
PROC=bmcapture

test -f $DAEMON || exit 0

doStart(){
    if ps aux | grep $PROC | grep -v grep > /dev/null
	then
	echo -e BitMeter Capture daemon is running...
	else
	echo -e Starting BitMeter Capture daemon: bmcapture
	$PROC &
	fi
}
doStop(){
    if ps aux | grep $PROC | grep -v grep > /dev/null
	then
	echo -e Stopping BitMeter Capture daemon: bmcapture
	pkill -f $PROC
	sleep 1
	fi 
}
case "$1" in
  start)
    doStart
    ;;
  stop)
    doStop
    ;;
  restart)
    doStop
    doStart
    ;;
  force-reload)
    doStop
    doStart
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}" >&2
    exit 1
    ;;
esac

exit 0
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Bitmeter for multiPup desktop

#93 Post by davids45 »

G'day Mike Walsh,

Thanks for the quick answer.

If Bitmeter keeps its data as a .db file in /var/lib, then can I set this file as a sym-link for each Pup's Bitmeter to the same 'real' bitmeter.db file on my computer's data partition? Whichever Pup I am using will then use this one-and-only common bitmeter.db file, so for this computer, I will have a single record of its internet usage.

I could do the same for the grandkids' old HP desktops here too, as they do like to play on-line ABC4Kids games for their age-group (1-4 years old) when not watching Peppa or Thomas or Roary or Sam or Bob or ... etc :roll:

David S.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

Re: Bitmeter for multiPup desktop

#94 Post by Mike Walsh »

davids45 wrote:...If Bitmeter keeps its data as a .db file in /var/lib, then can I set this file as a sym-link for each Pup's Bitmeter to the same 'real' bitmeter.db file on my computer's data partition? Whichever Pup I am using will then use this one-and-only common bitmeter.db file, so for this computer, I will have a single record of its internet usage...
Hmm. I don't know, to tell the truth. As I've stated in the thread, I'm pretty new to all this, compared to some other folk on the forums.....only been here for about 10 months, I think..?

I only discovered the use of 'sym-links' myself less than a month ago! If you mean would it work for multiple 'Pups' on the same hard drive, well..... Actually, I can't think of any reason why that shouldn't work; as long as they were all running the same version of BitMeter (0.7.6 or 0.8.0; I don't know if it would make a difference if you had, say, a mixture of 32- & 64-bit 'Pups'...)

I don't think it would work across a network for multiple machines, though.....I have no idea if symlinks can be set across a network (I'm more than willing to learn, though!) That's where Rob Dawson's 'bmsync' utility normally comes in; you can read more about that here:-

http://codebox.org.uk/pages/bitmeteros/bmsync/man

As I understand it, though, 'bmsync' has to be run manually (say like once or twice a day, simply to total data readouts across a network); I don't think it can be set to 'autorun'...

Something to think about, there... Thanks for that, David. I've been wondering if there was another way to 'sync' data in that manner; I've never been able to use 'bmsync' between OS's on the same machine, because it isn't designed to work like that. It's intended for use between two physical machines, running simultaneously.....you could have 20 Pups on one machine, but you can only physically run one of them at a time...

Try it, is all I can say. What's the worst that can happen?


Regards,

Mike. :D
Last edited by Mike Walsh on Mon 18 May 2015, 08:26, edited 1 time in total.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#95 Post by Mike Walsh »

@Geoffrey:-

A question for you. If you look at the last couple of posts, between me and davids45; would that idea work? Or would you get multiple instances of the same data?

What part of the app is it that actually writes to the database in /var/lib? Would that need to be what was 'sym-linked'.....or have I got hold of the wrong end of the stick here?

My 'noob-ness' is showing, ain't it? :lol:


Mike.

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#96 Post by Geoffrey »

Mike Walsh wrote:@Geoffrey:-

A question for you. If you look at the last couple of posts, between me and davids45; would that idea work? Or would you get multiple instances of the same data?

What part of the app is it that actually writes to the database in /var/lib? Would that need to be what was 'sym-linked'.....or have I got hold of the wrong end of the stick here?

My 'noob-ness' is showing, ain't it? :lol:


Mike.
Sharing the database from outside the save file should work for multiple pups on the same machine using a symlink , the database file for the 32 and 64 bit versions appear to be the same, so sounds like a plan :wink:

We're all noob's with varying degrees of experience and constantly learning :)
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#97 Post by Mike Walsh »

@Geoffrey:-
We're all noob's with varying degrees of experience and constantly learning :)
That's for sure.....

Okay; enough with the jollity, already..! :lol: To expand upon this, I would like to know something else here, if I may?

If you go into /var/lib, then click on the 'bitmeter' directory, there's 3 items, yes? I know what the 'runweb.sh' does, but there's two database entries; 'bitmeter.db', and 'bitmeter.db.new'. What's the difference between these; does BitMeter use the value from the latter, add it to the former, and then overwrite.....or something? In other words, is one temporary storage, until the total is calculated and written to the 'permanent' database?

This is, of course, assuming that you can 'see' the structure of the app in the coding, and are able to figure out quite how it runs...

I'm just curious as to which of those '.db' files should be used as the symlink for obtaining an overall total between multiple Puppies...and I suspect davids45 would like to know, too!


Mike. :?

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#98 Post by Mike Walsh »

@Geoffrey, davids45:-

Now, then; seems we have an answer as to whether symlinking to a common database will work...

It won't.

I initially set up a small data partition. In Tahrpup, I then dragged /var/lib/bitmeter/bitmeter.db across to it, and 'Moved'. I then dragged it back again, and this time 'Link(Absolute)' to create the link. By itself, this works fine.

In Slacko, I then repeated things; only this time, I deleted /var/lib/bitmeter/bitmeter.db from Slacko's install, and symlinked Tahrpup's bitmeter.db (from the new partition) back to it.

Did the same thing again in OBPrecise 14.07.26 'ChromeBook' Pup.

I then went back to Tahrpup, to see what the result was. And.....a big, fat zero. BitMeterOS had quit working. 'This page is not available...'

It was the same story in Slacko & ChromePup. BitMeterOS was non-operational. For now, I've uninstalled, and re-installed, so everything is currently back to stand-alone separate databases, as it was originally.

Mind you, I'm willing to bet that this is mostly due to my lack of experience with the way scripts work.....and not really knowing quite what I'm doing. I'm more than willing to be tutored, here..!

Perhaps the common 'bitmeter.db' needs creating from scratch, rather than copying, and then symlinking one of the originals? I honestly don't know. Or could it be that where I've gone wrong is in not stopping BitMeter before setting up the symlink? I know your script auto starts BitMeter at boot time, so.....how do I temporarily stop it, and then re-start it?

Thoughts? Comments?


Mike. :(

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#99 Post by mikeb »

database..its an sqlite database so those rules apply... how it would behave for multiple simultaneaous accesses...hmm could be interesting .
Otherwise a symlink makes sense for sharing...assuming all using the same version of bitmeter AND the structure of the data is not custom per machine... though its totals that are of interest for a group of machines...might mean 0.7.8 handles it better...just my view of the subject. By the way no usage logging in my netgear...you would need bitmeter adding to it :)

Geoffry.
Yes that start stop script seems suitable...and should work for any pup...I did a simpler version for testing thats all. bitmeter binaries do not self daemonise so have to be handled as such.

I have a libpcap from debian etch that worked..158k...and that is really 0.9.5 not 8..I just renamed it...seems like an old lib which also means anything calling it specifically would be fine. I wonder how small a true 0.8 version is :)

wow busy thread... and no spell checker :D

mike

gcmartin

#100 Post by gcmartin »

Hope no one get upset by this entry, but, @Davids45 is really a VERY GOOD question for the many/most of us who have a LAN with TVs, PCs, etc.

His question points to a central point of collection. This is important as internet enters the home network via some central point. And at that central point is where accountability should exist.

Thanks @Davids45 for presenting that.

Now that this is presented to us, it steers us to look at some mechanism that can be employed such that monitoring traffic in/out of the home network can be accurately measured and available to all.

@Gyro has presented a very workable solution available to ALL in the forum community without the need to ask for permission. Its uses simple off the shelf items and it appears, though it is based at 32bit, that it is no great leap should anyone want to use on any platform. His solution is a PUPPY distro based router for a home network. Thus, this solution running in that frame would accomplish the best as any local PC could simple access its web port for display or taskbar popup data display.

This or similar approach would mean a single LAN monitor with every PC having access to review data traffic accurate for the home network relating to its internet traffic.

One last item to note. If a central approach like @Gyro's is used, the neat thing is that it could morph to any known solutions for getting internet to the home:
  • @Gyro's project via modems (cable/dsl/fiber) from ISP
  • @Gyro's project via modems (2G/3G/4G) from telcos
  • @Gyro's project via router front ending the home network
  • @Gyro's project via phone tethering
  • @Gyro's project via satellite
  • etc.
Thus @Gyro's project offers great flexibility in setup and use with any of these individually or in combinations.

Hope this clarifies a view that I perceive from his question. This does NOT change what is already done. Again, "To address this thread's efforts, centrally, in no way changes this thread's work." It merely moves the collection point to Gyro's router project's ability, while also making this thread's information available to all on the LAN without each LAN device being a collection point, individually.

This can be done on something a simple as an old motherboard, alone (little or no peripherals), as long as it has the limited RAM needed to run the router-bitmeter-browser to expose the port. Several ways to boot something this simple. Almost a nocost/lowcost solution for control beyond the Telcos and ISP ramp devices. And, there are many similar hardware for a PUP setup which can be useful from ... to ...

Hope this helps
Last edited by gcmartin on Mon 18 May 2015, 23:15, edited 5 times in total.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#101 Post by Mike Walsh »

Hi, gcm.

Hmm. Thinking about it, I guess you're right; this could very well lead to other developments. Admittedly, that wasn't uppermost in mind when I started the thread (!), but as with so many other things over the years, one thing will of course lead to another...

Of course, it all depends on how much interest is generated, and how many other folk see this potential.....and are willing to put in development time. There's the rub.

Certainly, a central data recording point (at the router) would make a whole heap of sense, where multiple machines on a single network are concerned...

Keep your fingers crossed; no telling what might happen!


Regards,

Mike.

robd
Posts: 4
Joined: Sun 17 May 2015, 14:52

#102 Post by robd »

Mike Walsh wrote:@robd:-

In fact, I DO have one question, now that I think about it. I moved to Linux about a year ago, as I said in my message to you. Nearly from the start, I looked for something similar to, and then discovered, BitMeterOS; I think the stable version then was 0,7.5, and 0.7.6 was the experimental version. When 0.8.0 was released, I moved to 0.7.6.

With 0.8.0, the web interface now shows the difference between total usage (up & down), and internet usage. It didn't take me long to find out that file-sharing via LAN was a lot more prevalent in the Linux world than it was in the Windows one. I've since come to realise that in fact, networking and 'file-sharing' is becoming quite standard these days, with the advent of media-streaming, and home-based media server setups.

Was this in your mind when you developed the 0.8.0 version?


Regards,

Mike.
Hi Mike,

Being able to differentiate between LAN and Internet traffic was by far the most requested feature from people using BitMeter OS and BitMeter 2 (my previous Windows-only meter) but unfortunately wasn't easy to implement - it meant using the pcap library to gather network stats rather than the much simpler method used in 0.7.6. The big advantage of using pcap however is that it lets you add filters for pretty much any type of internet traffic, the 4 default filters are the ones most people stick with but using the 'bmdb addfilter' command you can add others using tcpdump syntax

hope that helps

Rob D

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#103 Post by mikeb »

if the pcap fits...use it :D

sorry

robd
Posts: 4
Joined: Sun 17 May 2015, 14:52

#104 Post by robd »

Mike Walsh wrote:
If you go into /var/lib, then click on the 'bitmeter' directory, there's 3 items, yes? I know what the 'runweb.sh' does, but there's two database entries; 'bitmeter.db', and 'bitmeter.db.new'. What's the difference between these; does BitMeter use the value from the latter, add it to the former, and then overwrite.....or something? In other words, is one temporary storage, until the total is calculated and written to the 'permanent' database?

Mike. :?
The bitmeter.db.new file isn't needed by BitMeter, it's just an empty database file which is included in the installer (if you still have one hanging around you can delete it).

If someone is installing BitMeter for the first time on their system then this file gets renamed to bitmeter.db and gets used by the application, however if someone is upgrading from an older version of BitMeter then obviously the installer shouldn't replace the existing bitmeter.db file containing all their data, so in this case the bitmeter.db.new file gets removed and the existing .db file is upgraded keeping all the data intact.

If you speak shell-script then you can see this going on here

robd
Posts: 4
Joined: Sun 17 May 2015, 14:52

#105 Post by robd »

Mike Walsh wrote:@Geoffrey, davids45:-
Now, then; seems we have an answer as to whether symlinking to a common database will work...
I think this should work, provided the location of the bitmeter.db file is correct from the point of view of each of the different operating systems - if you need to have the file somewhere other than the default location you can set an environment variable to point to it as described here

Obviously the file will also need to be both readable and writeable by each O/S as well.


User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#107 Post by Mike Walsh »

Hi, Rob.

Thanks very much for clarifying some of that for us. Hopefully it will help out some of our 'experts' (I don't include myself in their number, as I'm very much a 'noob' when it comes to this kind of thing!)

Those of us who understand what you're referring to will no doubt be able to do something with it. I mean, I basically understand what's going on, but I don't know the first thing about scripting...so can't therefore, put it into practice myself.

I don't know whether you followed my description of trying to set up a common, symlinked database this morning; some of the development work here has been due to the need to make the debian packages work with Puppy's rather unique, union-layered filesystem. From what I can make out, this in turn is partly due to the sheer number of different ways there are of not only running, but booting Puppy, too.

I'm slowly getting the hang of it.....and this is where a dedicated, and very knowledgeable & friendly community comes in so handy; you can almost guarantee that whatever your problem is, somebody, somewhere, will have come across the same situation before.

You say the common database would need to be not only readable, but writeable, too. This is my big stumbling-block at present; permissions..! I'm guessing this is why BitMeter quit on me, the way it did...

One other query, from my point of view, if I may? This business of changing the environment variable to point to the *changed* location of the bitmeter.db file; I hate to get so basic over stuff like this, but where exactly do you make the change? Do I do this in the terminal...and if so, what commands would need to be used?

I know there's at least one other person who would like to know the answer to this...


Regards,

Mike.

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

BitMeter sharing with multiPups

#108 Post by davids45 »

G'day Mike Walsh, robd, gcmartin, etc,
I did try the simple symlink for the .db file and found like you it did not run :( .

However, another symlink strategy I use, particularly with big packages like LibreOffice and wine, is to set up an expanded pet of each such pet with Muppy-Filer on my data partition.
This gives me a subdirectory of a pet with the paths for a normal install of the pet retained as sub-subdirectories.

I now make symlinks for every sub-directory of the pet on the data partition to the same sub-directory of the running (Full) Pup. A bit manual in setting up but I'm used to it now. Sometimes, I only need to link a few bin files to their 'normal' places and the package runs as though it is installed in the Pup rather than sitting on another partition. Seamonkey is good this way, I just link the seamonkey executable to /usr/bin/ from its subdirectory on the data partition and it runs. I also link the root/.mozilla/seamonkey/ profile back to my common profile so all my mail and bookmarks are available on all Pups.

With Frugal Pups, it is much easier as I just make a ginormous sfs of my wanted packages, although the symlinks still work for things like my Seamonkey profile.

My data partition is mounted at boot for all my Pups via a /root/Startup script - which becomes the first thing I must to do after any new Pup install.

So, back to the matter in hand, as there is a pet of Bitmeter, I'll try this approach next. Expand the pet to its own sub-directory on my data partition then make links of these now expanded files to their intended locations in a Pup.

And see if I can get it to work :D . And if it does, then repeat this in another Pup. And if I see the totals are carried forward with both Pups' sets-up, try another. :lol:

All good fun.

David S.

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#109 Post by Geoffrey »

Mike Walsh wrote:Now, then; seems we have an answer as to whether symlinking to a common database will work...(
Symlinking works, I moved bitmeter.db to the partition outside of the save file and linked it back, works fine as I thought it would, so if you run a different pup version then all you need do is remove the /var/lib/bitmeter/bitmeter.db and create a symlink to the bitmeter.db you previously moved, bitmeter.db could be moved anywhere as long as the location is mounted at boot.
davids45 wrote:G'day Mike Walsh, robd, gcmartin, etc,
I did try the simple symlink for the .db file and found like you it did not run :( .
In the terminal run

Code: Select all

/etc/init.d/bitmeter restart
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Bitmeter Pet OK in several Pups

#110 Post by davids45 »

G'day,
Geoffrey's pet worked when first installed on this HP desktop in Pups such as Wheezy, Slacko, Precise.

Setting up the symlink to centralise the network data onto my data partition (sda5) however causes problems.

"Page Load Error Failed to connect"
I've attached before and after screen shots in one of my Wheezy Pups.
I had the 'Page Load Error' in all Pups when doing the link with the Pup not running (used another Pup and mounted the target Pup partition to edit the location of the .db file).

"NaN PB" output to summary tab
If doing this symlink while Bitmeter is running, I saw the Bitmeter browser numbers (lots of MB and kB) display go to lots of 'NaN PB' values as per the attached screenshot.

The encouraging thing for me is when watching the Wheezy desktop/pinboard after the symlink and getting the page load error browser box, on the two open (file-manager) Rox windows, I could still see Bitmeter was scanning, and the linked file on sda5 was increasing in size when I refreshed that window.

So I think it's almost happening for Bitmeter on this multiPup computer, just the browser/db-file-symlink is not behaving, or I'm doing something wrongly?

I tried Geoffrey's /etc/init.d/ script (and when I typed it in correctly :oops: ), it reported the daemon was running. But still nothing via the browser except the 'page load error'.

Hoping these screenshots are readable and helpful.

David S.
Attachments
NaN_PBdisplay_postlinking.jpg
Symlinking to copied .db file and Bitmeter display went from numbers (of MB & kB) to these NaN PB entries.
(105.3 KiB) Downloaded 255 times
BmeterAfterLink_Wheezy.jpg
Copying db file to sda5 then creating link in /var/lib/bitmeter as per Rox boxes; opening Bitmeter gives browser "Page Load" fail as per Seamonkey box.
(159.22 KiB) Downloaded 297 times
Wheezy_Bmeter_installed.jpg
WheezyPup after installing Bitmeter pet. db file at /var/lib/bitmeter
(138.22 KiB) Downloaded 278 times

Post Reply