• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

bandwidth counter for mobile data connection

Scheduled Pinned Locked Moved OS
20 Posts 8 Posters 2.9k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • U Offline
      uri
      last edited by 31 Jul 2018, 06:42

      Hello,
      I have a small bandwidth mobile phone contract so I need to control my usage of bandwith.
      I use vnstat (https://humdi.net/vnstat/)
      It is not sophisticated but it works.

      Example of result:

      phablet@ubuntu-phablet:~/Scripts$ ./consum.sh

                        rx      /      tx      /     total    /   estimated    
      

      ccmni0:
      jul '18 2,08 MiB / 289 KiB / 2,36 MiB / 0 KiB
      yesterday 0 KiB / 0 KiB / 0 KiB
      today 0 KiB / 0 KiB / 0 KiB / --

      I haven't found no ubuntu repo with vnstat compiled for our platform so I get it from debian.

      Here I get the version of debian depending on my version of ubuntu:

      https://askubuntu.com/questions/445487/what-debian-version-are-the-different-ubuntu-versions-based-on

      So I'll download for version 15:
      https://packages.debian.org/jessie/vnstat

      And for version 16 (Sorry Haven't tried it, still on 15!!!) should be
      https://packages.debian.org/stretch/vnstat

      Next I need to check my arquitecture so I open a console on my phone and

      dpkg --print-architecture
      In my case the answer is
      armf ( vegeta)
      So I download the correct version

      http://ftp.de.debian.org/debian/pool/main/v/vnstat/vnstat_1.12-2_armhf.deb for ubuntu 15.

      In order to dpkg a file the filesystem needs to be on read write mode.

      mount /dev/loop0 / -o remount,rw

      sudo dpkg <filename>

      My root filesystem is on readOnly mode most of the time. Vnstat needs to keep info and It can't be on base filesystem.

      I Edit the /etc/vnstat.conf and put the database dir inside the home.

      DatabaseDir "/home/phablet/.vnstat"
      and reboot the phone (I don't know if this is mandatory ).

      create dir /home/phablet/.vnstat

      First I need to tell vnstat to control the ccmni0 connection.

      vnstat β€”create -i ccmni0

      finally I have a script with this instructions:
      sudo vnstat -u
      sudo vnstat -i ccmni0 -d -s

      The first one updates vnstat internal counters and the next one gives the already shown result.

      PS: Feel free to move this post where it should be if it's not in the rigth place.
      Feel free to correct, change or update anything.
      Thanks to all active people that are making UBPORTS REAL.
      Salut!

      A 1 Reply Last reply 31 Jul 2018, 07:04 Reply Quote 3
      • A Offline
        advocatux @uri
        last edited by 31 Jul 2018, 07:04

        @uri hi, vnstat is compiled for xenial (armhf) already πŸ™‚

        See all the available archs for that package here https://packages.ubuntu.com/xenial/vnstat

        1 Reply Last reply Reply Quote 0
        • U Offline
          uri
          last edited by 31 Jul 2018, 08:32

          The link you provide does not give any download url ( or I can't see it). This is the main reason I looked out of ubuntu repos.
          But, of course, I can be wrong as usual...
          Thanks

          1 Reply Last reply Reply Quote 0
          • A Offline
            advocatux
            last edited by advocatux 31 Jul 2018, 09:36

            @uri as a general information, if you click on "download vnstat" in that page, you'll find the related info about that [0].

            In short, you need to use any mirror [1] you want, and download the package you want directly or use apt with the proper sources.list.

            It seems there's a problem in this specific case though, because in spite of the package being named (vnstat_1.14-1ubuntu2_armhf.deb) with its checksums and all, when you go to v.g. http://us.archive.ubuntu.com/ubuntu/pool/universe/v/vnstat/ the armhf package is not there.

            I don't know why, sorry.

            [0] https://packages.ubuntu.com/xenial/armhf/vnstat/download
            [1] https://launchpad.net/ubuntu/+archivemirrors

            1 Reply Last reply Reply Quote 0
            • U Offline
              uri
              last edited by 2 Aug 2018, 10:53

              I don't know why neither. But don't feel sorry.
              I just looked for a way of getting what I wanted... Thanks for your replies and as I said before (as I'm not an expert nor even an amateur), Feel free to correct, change or update anything that could improve the main goal of the post.
              Salut!

              1 Reply Last reply Reply Quote 0
              • H Offline
                hummlbach
                last edited by 3 Aug 2018, 00:11

                Do we have an app for that? We should... Or better: this could be the first useful information for the lock screen stats... πŸ˜‰ Instead of displaying the data for today, it should display the data for the current month in that case...

                S 1 Reply Last reply 6 Aug 2018, 10:19 Reply Quote 0
                • U Offline
                  UKPhil
                  last edited by 3 Aug 2018, 03:49

                  This I think would be very useful as a section of the "Today" screen. I would love to be able to develop something like this along with a dual display clock that can show two countries time for the screen.

                  1 Reply Last reply Reply Quote 0
                  • F Offline
                    fisch02
                    last edited by fisch02 8 May 2018, 18:23 5 Aug 2018, 18:19

                    The corresponding package can be found under: http://ports.ubuntu.com/pool/universe/v/vnstat/vnstat_1.14-1ubuntu2_armhf.deb

                    1 Reply Last reply Reply Quote 1
                    • S Offline
                      stefwe @hummlbach
                      last edited by 6 Aug 2018, 10:19

                      @hummlbach said in bandwidth counter for mobile data connection:

                      Do we have an app for that? We should... Or better: this could be the first useful information for the lock screen stats... πŸ˜‰ Instead of displaying the data for today, it should display the data for the current month in that case...

                      an app can put this information inside the "circle", there is a api

                      Meizu MX4 16.04 | Nexus 5 16.04

                      U H 2 Replies Last reply 8 Aug 2018, 13:30 Reply Quote 0
                      • U Offline
                        uri @stefwe
                        last edited by 8 Aug 2018, 13:30

                        @einstein212 I agree. It sounds really beautiful...

                        @fisch02 yes for version 16 of ubports. But where is vnstat for ubuntu 15?
                        Still a mistery.

                        1 more thing:
                        By the way that I'm working with vnstat, it resets it's counters on every 1st day of month. I don't know if its customizable or not.

                        I'm so sorry, I have no time nor knowledge to develop this, but here is the first brick of it.
                        Thank you all.

                        1 Reply Last reply Reply Quote 0
                        • F Offline
                          fisch02
                          last edited by 8 Aug 2018, 14:25

                          @uri Package for vivid: http://old-releases.ubuntu.com/ubuntu/pool/universe/v/vnstat/vnstat_1.12-2_armhf.deb

                          A 1 Reply Last reply 8 Aug 2018, 14:35 Reply Quote 1
                          • A Offline
                            advocatux @fisch02
                            last edited by 8 Aug 2018, 14:35

                            @fisch02 wow you found it! πŸ™‚

                            There are a lot of vnstat packages for armhf in that directory. I think this is the latest http://old-releases.ubuntu.com/ubuntu/pool/universe/v/vnstat/vnstat_1.14-1ubuntu2_armhf.deb

                            1 Reply Last reply Reply Quote 0
                            • F Offline
                              fisch02
                              last edited by 8 Aug 2018, 14:48

                              @advocatux According to http://old-releases.ubuntu.com/ubuntu/dists/yakkety/universe/binary-armhf/Packages.gz , vnstat_1.14-1ubuntu2 is for Yakkety Yak (aka. 16.10), while according to http://old-releases.ubuntu.com/ubuntu/dists/vivid/universe/binary-armhf/Packages.gz the Package for Vervid Vivid (aka. 15.04) is vnstat_1.12-2.

                              A 1 Reply Last reply 8 Aug 2018, 14:53 Reply Quote 0
                              • A Offline
                                advocatux @fisch02
                                last edited by 8 Aug 2018, 14:53

                                @fisch02 interesting, because in https://packages.ubuntu.com/xenial/armhf/vnstat/download you can see vnstat_1.14-1ubuntu2_armhf.deb as the version for xenial

                                1 Reply Last reply Reply Quote 0
                                • F Offline
                                  fisch02
                                  last edited by 8 Aug 2018, 15:04

                                  @advocatux The old Package link, that I send on your Request is the one for the current stable UBports, which uses an outdated Ubuntu 15.04, while the first one is for the rc and devel UBports, which use the currently supported Ubuntu 16.04. This also the reason, why both Packagelinks have a different subdomain

                                  A 1 Reply Last reply 8 Aug 2018, 15:08 Reply Quote 0
                                  • A Offline
                                    advocatux @fisch02
                                    last edited by 8 Aug 2018, 15:08

                                    @fisch02 ah, okay, sorry for the misunderstanding!

                                    1 Reply Last reply Reply Quote 0
                                    • H Offline
                                      hummlbach @stefwe
                                      last edited by 8 Aug 2018, 19:07

                                      @einstein212 mhmm... I don't know the api yet, but i guess i have to start the app at least to make the api calls that update the figures...(?) But why should actually start the app if I have the data in the circle indicator...

                                      1 Reply Last reply Reply Quote 0
                                      • EllypsisE Offline
                                        Ellypsis
                                        last edited by 6 Sept 2018, 22:36

                                        I was about to post a reply to this post, but I found this bug on GitHub : Mobile data usage monitoring #66
                                        Just to let other know that's a work in progress πŸ˜‰

                                        1 Reply Last reply Reply Quote 0
                                        • U Offline
                                          uri
                                          last edited by 6 Jun 2019, 22:29

                                          An update on vnstat on Nexus 5:
                                          instead of ccmni0 the network interface is rmnet0.
                                          The easiest way to get it is getting the list of ifconfig network interfaces and start guessing.
                                          Salut!

                                          M 1 Reply Last reply 8 Jun 2019, 07:26 Reply Quote 0
                                          • M Online
                                            matteo @uri
                                            last edited by matteo 6 Aug 2019, 07:52 8 Jun 2019, 07:26

                                            @uri even though this is an old revived thread, only to let you know I'm right now working to provide an app bringing such a capability. I'm facing right now some troubles but I'm along the way to solve all those and maybe soon I'll come out with a concept app. Only for your information, the approach in my app is to exploit the API QNetworkConfigurationManager.

                                            Matteo

                                            1 Reply Last reply Reply Quote 1
                                            • G Gernulf referenced this topic on 4 Aug 2023, 17:45
                                            • First post
                                              Last post