Sunday, 5 February 2012

How To Display Network Upload / Download Speed On The Panel In Ubuntu 11.04/11.10?

Indicator-Sysmonitor (System Monitor Indicator) is a really interesting Ubuntu indicator because it allows you to display pretty much anything on the Unity (or GNOME) panel by using a simple command or a bash script.

(Speaking of Indicator-Sysmonitor: a recent update brought sensors support (make sure you install hddtemp and lm-sensors), but this post isn’t about that)

Currently there is no AppIndicator to display the actual network usage as in the actual values on the Unity panel in Ubuntu 11.04. We have Indicator Multiload but it only displays a graph so I wrote a script for Indicator-Sysmonitor to display the network upload/download speed as well as CPU and Memory usage (Indicator Sysmonitor already has CPU and Memory usage but if you want to use a script, you must get your script to display the CPU and Memory usage independently).

Now open Indicator-Sysmonitor (it should show up as System Monitor Indicator in the menu), then click it on the panel and select “Preferences” and under “Use this command”, enter this:

$HOME/scripts/sysmon

Then save. For me, each time I save the Indicator-Sysmon preferences, the applet freezes. If that’s the case for you too, run this in a terminal:

killall indicator-sysmonitor

Then start it again.4. Configuring the script

By default, the script displays the RAM and network usage. You can also display the CPU usage or any other combination (display the network usage only, display all: the CPU, ram and network, etc.). For this, open the script (run the following command in a terminal):

gedit ~/scripts/sysmon

And on top of the file you’ll see something like this:

#settings: netspeed=true ram=true cpu=false

What these do is pretty much obvious – change the items you want to be displayed on the panel to true and the rest to false. Feel free to tweak the script to display other stuff if you want.