Network monitoring tool

March 5th, 2009

Today I wanted to monitor the network usage on my Linux box. Compared to what most bandwidth monitoring tools do I wanted to monitor the bandwidth per process - usually most Linux tools tools just monitor the bandwidth per interface. And I realized that is actually a very rare thing on a Linux system to monitor the network per process.

But suddenly I remembered an article I read some time ago about a network monitoring tool that calculated the bandwidth usage per process. It looked something like top but for network usage and per process. It wasn't however very easy to find again and it took a rather long time before I eventually found it again. So for future references I decided to write a blog entry about it.

The tool is called NetHogs and is available for installation in any ordinary Linux system by default.

Hint: Press 'm' to toggle the unit.

Subversion version conflict

March 2nd, 2008

I reinstalled my server this weekend. I felt like my old 20 GB Maxtor hard drive had done it job and it was time for an upgrade. The label said it was constructed in October 2001 so that is at least seven and a half years. I purchased two new 160 GB hard drives and configured software RAID1 (mirror). It works like a charm, and now my data is more safe than ever ! ... at least that is what I try to tell myself.

However, I previously ran Debian unstable and now I figured it would be more reasonable to run Debian stable (etch) instead. This caused some problems with subversion and apache. I run mod_dav_svn in apache with SSL for secure data transfer for all my subversion access. And since Debian stable has a lower version of subversion than unstable my subversion repositories was not fully compatible.

The apache log threw out a lot of errors for each commit:
[Sat Mar 01 23:39:22 2008] [error] [client 192.168.1.109] Could not create activity /svn/(the_repo)/!svn/act/8b8e0c43-322c-470b-9c65-25a848f3db49. [500, #0]
[Sat Mar 01 23:39:22 2008] [error] [client 192.168.1.109] could not close dbm files. [500, #89026]
[Sat Mar 01 23:39:22 2008] [error] [client 192.168.1.109] Can't close activity db: Error string not specified yet [500, #89026]

And then similar errors when I removed the repo/dav directory (It thought it would be recreated):

[Sun Mar 02 18:31:27 2008] [error] [client 192.168.1.109] Could not create activity /svn/(the_repo)/!svn/act/40d2c87d-b10e-43e0-ba33-51990522c17d. [500, #0]
[Sun Mar 02 18:31:27 2008] [error] [client 192.168.1.109] could not open dbm files. [500, #120002]
[Sun Mar 02 18:31:27 2008] [error] [client 192.168.1.109] Can't open activity db: APR does not understand this error code [500, #120002]

It took me a while to figure out that the dav directory must exist inside the repository but that the activity file should be removed. So the solution was to simply only remove the activity file and now it works again.

Yeah, and as you might imagine... one of my hard drives died the other day :( I guess that is what motivated the upgrade. Even if I had thought about the upgrade for the server for a long time I never took myself the time to make the upgrade before. A hard drive crash every now and then is probably good for data security :)

Laptop update

January 27th, 2008

I did a fresh reinstall of Ubuntu on my laptop today, now it runs Gnome after 2-3 years of reliable KDE usage :) If I remember correctly I installed an early release of Breezy Badger on it because the kernel in Hoary Hedgehog didn't have good support for my S-ATA controller. It has worked like a charm ever since, so it's not that it didn't work any more it was more like a fun thing to see how the installer behaves now. In addition, I'm running KDE 4 on my desktop at home now so I want at least one computer with Gnome on it.

So, for the real purpose of this post... It does not seems to be so easy to customize the locale settings in Gnome as it could be. I really want to use English as the language on the computer but having dates etc in Swedish. Unfortunately this has to be configure in a text file in the home directory so its not that easy for newcomers. Anyway, adding the following lines to ~/.gnomerc solves the problem.


export LC_TIME=sv_SE.UTF-8
export LC_CTYPE=sv_SE.UTF-8
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8

Pegasos, X and Ubuntu Feisty

April 22nd, 2007

Well, yet again X do not work on the Pegasos due to pciscan issues. Unmounting /sys is a simple, but ugly, workaround. An other but still ugly solution is to recompile xorg and force it to use /proc for pciscan, which I did.

The repository is the same as for edgy but edgy replaced with feisty. Note the trailing / after binary is IMPORTANT.



Add that line to your /etc/apt/sources.list file and make a system update and X should start again (that is apt-get update and then apt-get dist-upgrade).

It is also good to install my public key so the packages can be verified for correctness.

Install it by running:
wget -O- http://kozz.org/files/keys/kozz-pubkey.gpg | sudo apt-key add -


Sources can be downloaded with:

Protection against ssh bruteforce attacks

April 15th, 2007

Everyone that has set up a ssh server on a computer connected to the Internet has probably their log full of random attempts from foreign hosts with failed login attempts. Even if the probability that they will succeed is close to zero it would feel to good to have an automated way to block hosts that have failed a few times to the ssh server.

Personally for my own computer at home I never felt that it was such a big problem that I took myself time to find a solution for it. But when we had a LOT of bruteforce attacks to the ssh server at work it felt worth doing something about the potential security hole. I googled it for a while and finally found DenyHosts (http://denyhosts.sourceforge.net/), a very simple program that parses /var/log/auth.log in a Debian system or /var/log/messages in a Gentoo system and adds rules to /etc/hosts.deny when a host has too many failed attepts to login to the server. Really simple but still so useful.

DenyHosts is available in the package system for both Debian and Gentoo, both works fine. Actually, I have installed DenyHosts on more or less every computer I have now :). Every now and then I get mail from the server saying it has blocked yet another host from log in. Have so far 16 hosts blocked in about just 2-3 days. Why don't you give it a try?

Diff is a wonderful tool

November 7th, 2006

We all just love diff, don't we?

The following line just made my day :)


diff -qr PNphpBB2.old PNphpBB2 | grep "^Only in" | grep -v "\.svn"


It list all removed/added files/folders between two directories. Simple, but still so powerful.

Pegasos and Ubuntu Dapper

April 26th, 2006

I have though about writing about Pegasos and Ubuntu Dapper for a while... but nothing happened :)

Today someone asked me about how to use Ubuntu Dapper on the Pegasos so there is probably need for some information about it.

I wrote a post about it over at PPCZone, http://www.ppczone.org/forums/viewtopic.php?p=2761#2761

Hope it works, works for me :)

KDE 3.5.1

February 1st, 2006

I wrote in my last blog about KDE 3.5.0 for Ubuntu, but since that repository do not work anymore I wanted to update with a new that works.

PowerPC is now officially supported in Breezy from Kubuntu, KDE 3.5.0 wasn't.

Read more at,
http://kubuntu.org/announcements/kde-351.php

KDE 3.5 in (K)Ubuntu

December 7th, 2005

Yep, KDE 3.5 was released for just some days ago and packages for Ubuntu was available fast after the release. Unforntunately the packages for PowerPC has not been released offical yet. I have used the "test" packages for PowerPC since the release of KDE 3.5 and they seems to work well. I do not however know when they will be released at http://www.kubuntu.org/ so thought it might be intresting for more to test out KDE 3.5 on PowerPC.

The packages are available at http://kubuntu.org/~amu/pool.

To install KDE 3.5 on your computer edit /etc/apt/sources.list and add

deb http://kubuntu.org/~amu/pool ./

Then execute
> apt-get update

to download the packages and run
> apt-get dist-upgrade

to install the packages.

Please, report if you find any problems.

Btw, KDE 3.5 kicks ass :P

Ubuntu Breezy Colony 5 on Pegasos

October 2nd, 2005

Yesterday I felt like trying out a relese candidate of the upcoming Breezy Badger release of Ubuntu linux on my Pegasos. And I must say, it works like a charm... almost.

A really good thing is that the cd now includes a chrp bootable kernel, which Hoary didn't. So one can simply download the cd and boot it without any modifications.

The cd can be found at:
http://cdimage.ubuntu.com/releases/5.10/colony-5/

To boot the cd in Smart Firmware:
> boot cd install/powerpc/vmlinuz-chrp.initrd root=/dev/ram

Yes, you still need to add root=/dev/ram...

The installer will start and you just have to walk through it as on any other computer. But ! Don't restart the computer because you will not be able to boot the system... :) In the last screen of the installer, just before rebooting, one addition step is required. I don't know why the chrp kernel isn't created automatically, but it seems like mkvmlinuz can't detect the system architecture automatically.

Press alt+f2 and enter to activate a new console.
Run:
> chroot /target
> mkvmlinuz -a chrp

Go back to the installer with alt+f1 and finish.

You can boot your system with somethink like
> boot hd:x boot/vmlinuz-2.6.12-9-powerpc root=/dev/hda(x+1)

Where x is the number of your partition in Smart Firmware, so x+1 is one larger than the number in Smart Firmware.

Almost works out of the box... :)