Newbie I/O Redirection Getting Started With VIM
Dec 15

I was wondering what nifty utilities were available for monitoring my bandwidth from the console. After a few minutes of googling I found my answer. There were two options that I found right away, bwm-ng and nload. Both programs have similar features so it really came down to look. Since I was slightly happier with nload, I installed it on all of my full-time Linux machines, this included Fedora 6, Ubuntu Edgy and a Debian Sarge server. Don’t take my word for it though, if you have a hankerin’ to monitor your bandwidth, check them both out.

The screen-cap below is shows nload and a few other programs running. The first row is the local machine (FC6), the second row is (from left to right) a Debian Sarge server and an Ubuntu Edgy desktop. The third row shows an available console and an scp command transferring a file from the Fedora box to the Debian box.

Bandwidth Monitor

Installing on Ubuntu:

Be sure that you have the Universe repo enabled (click here for help)

sudo apt-get install nload bwm-ng

Installing on Fedora:

Installing an nload package on Fedora requires adding another repo to your yum configuration. The steps are below.

1: First create the dries.repo file as root. If you aren’t a Gnome user, you can substitute gedit with kwrite or kate below.

su -c 'gedit /etc/yum.repos.d/dries.repo'

Paste the four lines below into the editor, save and exit:

[dries]
name=Extra Fedora rpms dries - $releasever - $basearch
baseurl=http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/linux/$releasever/$basearch/dries/RPMS/
enabled=0

2: Download the GPG key, install it and then remove the local copy (once it’s imported, you don’t need the key file any longer)

wget http://dries.studentenweb.org/rpm/RPM-GPG-KEY.dries.txt

su -c 'rpm --import RPM-GPG-KEY.dries.txt'

rm RPM-GPG-KEY.dries.txt

Done, now you can install the programs via yum. The Dries repo isn’t enabled by default (I only leave official yum repos enabled on my machine). The command below will enable the repo for this install only. If you want to enable dries full-time, edit the dries.repo file and change enabled=0 to enabled=1.

su -c 'yum --enablerepo=dries install nload bwm-ng'

written by M@ \\ tags: , , , , ,

2 Responses to “Console Bandwidth Monitors: nload & bwm-ng”

  1. Chris Fazekas Says:

    I’d like to put forward the use of vnstat. I’ve found it great app for monitoring my servers. I’ve also setup a script that runs every hour to check the bandwidth and depending on a maximum variable it emails me to let me know bandwidth has been exceeded.

    Here’s the script for anyone interested:

    #!/bin/bash
    #####
    ## Bash script to pull the total bandwidth from vnstat and check to see
    ## if it is greater or equal to maxdaily (in MB) and if so, email a notification.
    ## if it is not greater or equal to maxdaily (in MB) then do nothing.

    date=`date`
    todayscurrent=`vnstat -i eth0 |grep today | cut -d “|” -f3 | cut -c “1-8″`
    maxdaily=”3500″ # in MB
    server=`uname -a`

    # if todayscurrent is greater than or equal to $maxdaily
    if [ "$todayscurrent" -ge "$maxdaily" ]; then
    echo -e “On $date, on `hostname`: \n\n$todayscurrent MB of bandwidth has been used. \nThis exceeds the Max Daily flag of: $maxdaily MB. \n\nCheck the server to ensure everything is cool” | mail -s “:SERVER: $server :BANDWIDTH NOTIFICATION:” notificaiton@mydomain.com
    # else
    # echo “I like Cheese”
    fi

  2. Matt Says:

    Much thanks! I’ll give it a shot :)

Leave a Reply