Network Data Usage Monitor

by pdcurtis

UUID: netusagemonitor@pdcurtis
Score: 23
Last edited: 1 week ago
Last commit: 19e4978f3a67413fdb5ef5d503eabb898c260ed9



A Comprehensive Data Usage Monitor with alerts and cumulative data functions for Cinnamon

The Network Usage Monitor Applet (NUMA)

Summary

The Network Usage Monitor Applet (NUMA) enables one to continuously display the speed and data usage on a selected interface. It is intended to make monitoring of mobile connections by USB Mobile Internet Dongles, through phones by bluetooth and by Mobile Wifi (MiFi) units easy to accomplish. To this end, a maximum data and easily changed Alert level can be set for the current connection. There are also a number of cumulative data monitors to track total usage with offsets and corrections as required. It builds on the Network Speed Monitor Applet project by adreadec.

Special Requirements:

  • For the basic facilities the gir1.2-gtop-2.0 library must be installed or the applet will not load. On both Mint and Ubuntu it can be installed by the synaptic package manager or with the terminal command:
    sudo apt-get install gir1.2-gtop-2.0

  • For full facilities including notifications, audible alerts and statistics the gir1.2-gtop-2.0 vnstat vnstati zenity sox libsox-fmt-mp3 libraries must be installed. On both Mint and Ubuntu they can be installed by the synaptic package manager or with the terminal command:
    sudo apt-get install gir1.2-gtop-2.0 vnstat vnstati zenity sox libsox-fmt-mp3
  • Cinnamon Version 1.8 or higher as it make comprehensive use of the new Cinnamon Settings Interface for Applets and Desklets.

Features:

  • The Applet:
    • Continuosusly displays Upload and Download rate in a fixed width 'steady' display
    • The Applet Background colour is:
      • Black when Current Interface not active
      • Green when Current connection and interface has provided data
      • Orange when the Alert level (as percentage of the Data Limit) has been exceeded
      • Red when the Data Limit for the current connection has been exceeded
        • Hover over Applet:
    • Displays continuously updated Upload and Downoaded data usage for the current connection
      • The Context Menu (Right Click):
    • Displays all the interfaces managed by the Network Manager Applet
    • Identifies any Active interfaces within Network Manager
    • Allows the selection of the interface to be monitored from those manged by Network Manager.
    • Allows the selection of an interfaces not managed by properly by Network Manager and/or interfaces for a connection initiated outside Network manager (ppp0 and bnep0). (bnep0 needs v20_2.6.0 or higher)
    • Identifies the interface which has been selected for monitoring.
    • Allows updating of the list of Network Manager Interfaces (eg after a dongle has been inserted or a bluetooth connection made)
    • Enables the Cumulative Usage Monitors to be reset and the date and time of reset displayed.
    • Provides links to:
      • The NUMA Settings screen.
      • The Gnome System Monitor
        • Left Click Menu:
    • Displays continuously updated Uploaded and Downloaded Data for the Monitored Interface.
    • If Alerts are enabled:
      • A slider to adjust the Alert level as a percentage of the Data Limit
      • A display of the exact Alert level percentage and tthe Data Limit
    • For each Interface where cumulative monitoring is enabled:
      • The interface and Cumulative Usage
      • A comment (entered in Settings) to remind one of when it was set/reset and the value when set/reset.
        • The Settings Screen allows:
        • Setting the Update Frequency (1 to 5 seconds)
        • The Resolution of displayed upload and downloads (0 to 2 decimal places)
        • Change the units for Data Limits and Cummulative Offsets between Mbytes or Gbytes
        • Setting an interface to use as Default if no other interface is active at start-up - for Wifi hotspots and Mobile Broadband where the connection is manual.
        • Enabling Alerts on the current monitored interface and setting the Data Limit for the current connection on that interface and
      • setting the Alert Level as a percentage of the Data Limit by a slider (duplicated in the left click menu as it is frequently used.
      • Enabling each of three Cumulative Usage Monitors Setting an offset for each Cumulative Usage Monitors (v20_2.6.0 or higher)
    • Switching on a Long Term Statistics Display (Requires vnstat and vnstati to be installed)
    • Enabling Actions when the Current Data Usage Limit is exceeded:
      • Do nothing other than put up a standard Cinnamon Notification - this displays for 5 seconds or so and ends up in the notification tray - very easy to miss.
      • Display a high priority Notification - this displays on to of other windows until you clear it but does not go into the notification tray - still easy to miss from a distance.
      • Display a full screen Modal Dialog - this is techie term (look it up on Wikipedia) and the result is the whole screen is blacked out with an information box and button to clear it in the middle and uses the internal capabilities of Cinnamon. It is impossible to miss if you are at or close to the machine.
      • Run a shell script which lives in the applet folder and is called alertScript - this can be customised by the user and the example plays a system sound file for 6 seconds (using Sox) , puts up a warning box using Zenity and sends a standard notification so you have a record in the notification tray.
      • Suspend the Machine after a brief period during which you can abort. This is also implemented by a script (suspendScript) so the user can fine tune it but the version provided uses Zenity for the warning message which has a 30 second timeout to allow you to abort. Another message is put up before suspending which should be on display when you wake up the machine.
        • Disable Networking for all connections managed by the Network Manager. This puts up a warning message and you can abort for a short period by clicking the Applet - not the OK button on the warning screen.
        • Set a delay before disabling Network Connections Enable a warning sound
    • Set the sound file to be played
      • Add or hide the Advanced functions from Housekeeping drop down menu

Additional Configuration

The display width, justification and font details are set using an external Cascading Style Sheet (.css) file which is in the main folder (usualy ~/.local/share/cinnamon/netusage@pdcurtis/stylesheet.css).

The settings in this css file govern the width of the Applet and the font. Changes may be required with some themes to avoid the display width being exceeded which leads to jitter with high network speeds and resolutions or to allow a reduced size width to save panel space. The latest version also allow the backgrounds to be configured using this css file to optimise to a particular theme although the defaults work well on most popular themes.

Status

The applet is based on a well tried core from the netspeed applet and has been tested on various systems initially running Ubuntu 12.04 and Mint 15 with a variety of themes. It has been tested using Cinnamon 1.8, - 3.2 and had minor modifications for the changes introduced in Mint 18. The current Version has been tested with Cinnamon 2.2 - 3.2 and Mint 16 - 18.1

Manual Installation:

  • Download from Cinnamon Spices
  • Unzip and extract folder netusagemonitor@pdcurtis to ~/.local/share/cinnamon/applets/
  • Install any additional programs required.
  • Enable the applet in Cinnamon Settings -> Applets
  • You can also access the Settings Screen from Cinnamon Settings -> Applets

Version information prior to the changes introduced by the new Cinnamon Spices Web site in January 2017

There is a full change log in the applet folder called changelog.txt which can also be accessed through the Context (Right Click) menu in the Housekeeping sub-menu. The earlier development was carried out on Github along with my other applets at github.com/pdcurtis/cinnamon-applets


36 Comments

-
2 months ago
This Applet has now been comprehensively tested with Cinnamon 3.2. It should retain it's settings during an upgrade from Mint 18 to 18.2 but if you find anything odd first do a completely un-install and reload it. NOTE: It should not and does not display in vertical panels as textual information needs to be displayed in the panel which is not possible with a vertical panel.

Please let me know if you have any problems.

Please also take the time to rate applets - it is important both for new users and to motivate applet writers!
-
6 months ago
I have recently been asked to modify NUMA to better satisfy users with broadband accounts with very large data allocations, many now have 50Gbytes/month or more. I have firstly made all the displays use units from Kbytes to Terabytes. Secondly I have increased the maximum values of limits and offsets to 200000 Mbytes (195.31 Gbytes) in the Settings (Configuration) window and there is a new drop down widget in to use Mbytes or Gbytes - continuing to use Mbytes has an advantage as it gives a finer resolution to Data Limits and Alerts and is set as the default. This has been uploaded as v30_3.0.6.
-
7 months ago
LoL...I was looking at the wrong git probably i thought it was yours. Sorry...mate my mistake and again great works here...kudos!!!!
-
7 months ago
@storm119 Thanks for the confirmation it is now OK. I am not sure what or where the problem was but it occurred on several of my applets uploaded the same day. I am surprised that you did not find any commits on github as I have made a lot of commits on my five applets over the last few weeks, I counted 11 including a major one on NUMA as well as several more cosmetic changes - were you looking at https://github.com/pdcurtis/cinnamon-applets ?
-
7 months ago
@pdcurtis...The *fresh upload* tested and confirmed....installing via applet working without any issue....great job!!!.

Btw...the github version seems old to me cause the last commit are 3 years ago....?
-
7 months ago
I have reproduced the problem and done a fresh upload which seems to be OK on several machines. Let me know if there are any more problems.
-
7 months ago
Thanks, fgalgani , With the working zip i managed to install !!
-
7 months ago
Thanks to fgalgani and storm119 for the additional comments. I will try to sort out why downloading from 'applets' does not work over the next couple of days and/or put a clean zip on my web site. My applets are also on github so previous versions can be obtained if you understand git!
-
7 months ago
@pdcurtis: thank you for this applet!

I confirm what @jessy said. I've got the same problem on a fresh installation of Linux Mint 18.
I solved by manually installing your applet.
Your zip doesn't extract correctly, but I was able to fix it. This is a working zip:
http://www.informatica-libera.net/files/netusagemonitor_pdcurtis.zip
-
7 months ago
@pdcurtis....i just registered here just to confirmed what @jessy said. I'm also downloading manually while trying to extract...archive manager throwing an error...cant extract. My guess the archive you uploading got corrupted...?.

Side note...previous version worked just fine and also i already uninstall the previous version before trying to install the latest as recommended by you...cheers

Linux Mint 18 Sarah (Cinnamon)....
-
7 months ago
Jessy: I do not understand why it is not installing from 'applets'. The file mentioned is in the folder and is a temporary file in any case. I suggest you install using the download link and unzipping as per Installation section in the write up above. I have had another report of problems when not installing from the download which is what I always do. I will look into it.
-
8 months ago
I tried to install the 'network usage monitor with Alerts' version v30_0.0
in linux mint 17.3 .
I can't install and get the error:
[errno 20] is no folder: '/tmp/tmph78gkH/netusagemonitor@pdcurtis/vnstatimage.png

I have previously installed a previous version and then all was good.
But i had to reinstall Linux mint 17.3 completely en now i get this error.

Can you help me?
thanks,
Christiaan Bouter
Weesp
Netherlands.
-
8 months ago
Changes described in my last post completed as well as including all the features present in the development version v20_2.6.0. See the change log for all the details. Tested on a couple of machines but feedback always welcome.
-
8 months ago
An update from the Author.

The current version has been initially checked with Mint 18 and Cinnamon 3.0 and works without major problems excepting the option of Suspending the machine when the data limit is exceeded which does not work. This results from the change in Mint 18 from use of upstart to systemd for system calls and initiation. You may also need to install gedit which has been replaced by xed in Mint 18 to view the change log and some other advanced files from the Right Click Menu.

I will issue an update after further testing but in the meantime it only involves changes to a single line in a script re-enable the suspend function. It has always been intended that the file should be edited by the user to fine tune their requirements. The change is only required if you use the Suspend feature.

If you want to make the change the file can be accessed from the Right Click -> Housekeeping and System Sub Menu -> Open Suspend Script (This needs the 'Add Development and Test Functions to Context Menu' box to be ticked in the Configuration Screen).

You should now have have a file open in an edit window and you should add/edit the lines starting at circa 32 to from

# Suspend via dbus
dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
exit 1

to

# Suspend via systemctl in Mint 18
systemctl suspend
exit 1

Note some of the lines may be wrapped if you use a narrow editor window

The really keen user can also search for all the occurrences of gedit and change to xed in applet.js
to avoid installing gedit!
-
1 year ago
Thank you so much for this. I've spent ages looking for something like this, but until this one, every single one I tried did not work on Linux Mint. Also thank you for the detailed install instructions, easy to follow for even a newbie like me.
-
2 years ago
Just wanted to say that this is probably the single most useful applet available for Mint. I also have a suggestion. If possible, it would be nice if vnStat's "rx" and "tx" could be replaced with "download" and "upload", "downstream" and "upstream", or something similar. Even though one can figure which is which, rx and tx seem to be terms used when dealing with things closer to the hardware. End users rarely get exposed to terms like these, many don't even know what downloading and uploading mean.

Thank you for all the effort you've put into this applet.
-
2 years ago
1) The applet don't detect my interface (actually enp1s0).
2) I try change the background of applet with stylesheet.css, but take no effect. (I would like to eliminate the green background)
-
2 years ago
It does not monitor this interface anymore: cdc-wdm0 !!!!
-
2 years ago
Hello Peter,
I registered just to say thank you for this great applet!
I use it in all my laptops.

Thank you again!
-
2 years ago
I registered to say thank you very much for maintaining this great applet.
-
2 years ago
The applet has been running under on Mint 17 rc and Cinnamon 2.2 on all my machines since they were released and no changes are needed to it.

The workround for the segfault problem in cinnamon and nemo has been effective and I have not had any instances in the last 2 months and none have been reported. Hopefully the underlying problem in Mint 17/Ubuntu Trusty has been solved in any case.

@Brahim There is still the file called stylesheet.css that I added 8 months ago in response to your first request. It can also be accessed from the right click menu in the Housekeeping and System drop down menu once you have enabled Add development and Test Functions to the menu on the settings screen. Remember that an update will overwrite your changes so back them up. The default colours are transparent so they work on dark and light themes equally well. I use the void theme on most of my machines.
-
2 years ago
How can I change the applet background colour to match my themes?
-
2 years ago
thanks for the update pdcurtis!! Now it detects network interfaces automatically like a charm! excellent work man! thanks for responding!!
-
2 years ago
That would be great pdcurtis! Thank you!!
-
2 years ago
I am currently testing a version which will detect if a standard network interface is in use automatically. This is a relatively simple change itself (three lines) and covers the initial use by normal users with an Ethernet or Wifi connection. But this still leaves an issue with users who also use mobile broadband and other Point to Point Protocol (PPP) connections - the users the applet was originally produced for.

So the change I am implementing will automatically select the first active interface at start-up But Only If no default interface was specified in 'settings' and not if the last interface was PPP0. I hope this removes the needs for any additional configuration boxes in 'settings', it is already complex enough.

@Brahim I believe this will mean it will work immediately for every user on Wifi or Ethernet whilst maintaining additional flexibility for more sophisticated use.

I like to test for a period before uploading so expect it to be available for download here in one to two weeks.
-
2 years ago
This applet is the best part of Cinnamon but it lacks one thing: Can you make it please detect network interfaces automatically like mate-netspeed?

link: http://packages.linuxmint.com/pool/import/m/mate-netspeed/
-
3 years ago
@steve51184

The problem seems to be in the cinnamon-settings API or more likely the system functions the cinnamon-settings API calls as it only occurs in Mint 16 systems and has only been reported on the latest very fast machines. The NUMA applet saves the cumulative data totals using cinnamon-settings (ultimately in a file) to give persistence across cinnamon resets and suspends, restarts etc and on very rare occasions this call causes a segfault. I have duplicated this in a test applet and separating the 'write' calls to the API in time and using internal variables for the rest of the time seems to fix it. This appears to be a viable work around until the underlying problem is fixed and I have not seen any segfaults for nearly 7 days of running time.

The latest version v20_2.3.17 has every workaround for the problem I can think of on the assumption it is a 'race condition' somewhere in Mint 16 - the 'write' calls to the API are now separated by half the repetition cycle from any other calls! If any users still sees a segfault PLEASE report it. Note - It only occurs when cumulative data monitoring is enabled by a user which is not the default in the latest versions.
-
3 years ago
any fix for this: https://github.com/linuxmint/Cinnamon/issues/2835
-
3 years ago
The new version allows cumulative monitoring to be turned off completely if segfaults occur for any user. If there are any problems Please do report them.
-
3 years ago
Can any users let me know if they see any segfaults (crashes) of Cinnamon or Nemo when using my applet. Several users have had segfaults which might be related to NUMA. If there is a linkage It could be an issue in ihe latest versions of Cinnamon provoked by the NUMA code or an error in the Applet (in which case why only on some machines). I have had several machines running almost full time for months without any Cinnamon segfaults and a few Nemo crashes which stop displaying the desktop which may or may not be related to NUMA -this will be a difficult issue to resolve unless I can reproduce it or get feedback here (or through the feedback forms on www.pcurtis.com.)

I will post any news as soon as i have it.
-
3 years ago
Hey, you're applet is involved in this bug on github re: segfaults in Cinnamon.

https://github.com/linuxmint/Cinnamon/issues/2835
-
3 years ago
Brahim - Thank you for your kind words, it helps make all the hard work writing this applet worth while! I have produced a version where the 4 backgrounds for 'not connected', 'connected', 'alert level reached', and 'data usage exceeded' are set within the existing css stylesheet (stylesheet.css in the applet folder which can be opened for customsation from the right click menu). The defaults have rounded corners which I think gives a better appearance. I like to test for a few days before uploading a new version unless it is a bug fix but it is available for you and others to test on my web site at http://www.pcurtis.com/spices.htm#numa_nightly
-
3 years ago
Wow!! Many thanks pdcurtis! This is the best Cinnamon applet and the most customizable applet and should be included by default in the next Cinnamon or through updates! One more thing can you make it more customizable in terms of colour. When my connection is active it turns green and that's nice but how can I customize that clour to match the overall theme!

Thumbs up sir!
-
3 years ago
infinity9, There is a version which allows one to switch display sizes on the right click menu or in settings now on my web site at www.pcurtis.com/netusagemonitor@pdcurtis.zip for you to try - it also offers a number of other enhancements. The usual caveats that there will always be less tested (beta) development version at that location so take care!. There is however a built in changelog so you can see what you have. Feedback from any users appreciated. Peter
-
3 years ago
To infinity9
A combied Download and Upload would be quite easy to do - I think the separate speeds are very useful but I could make a half size applet option with a combined upload and download for small screens, maybe cut back on the KB/s text a bit as well. Give me a couple of days for a trial. You may even be able to edit the .js file yourself

I am also working on an option to display vnStat output to provide daily and monthly output as per Clem's Netspeed Usage Monitor.

You can see the latest developments at www.pcurtis.com/spices.htm#numa where I plan to keep a development version available for download - Use with Caution as it will not be stable and may suffer regressions
-
3 years ago
Love this applet, been looking for sometime,
Could you please have an option to combine Download and Upload speeds.
It would be looking more compact and simpler to read.