PCs

System monitoring with Conky

Vincent Danen explains how to use the monitoring tool Conky to get crucial information on system performance. This system monitoring tool can operate in window-less mode, so it persistently anchors to the desktop, preventing it from being moved or closed.

My number one favorite system monitor used to be Gkrellm, a small GUI tool that displays system information such as CPU usage, memory and hard drive usage, network throughput, and so forth. Recently, I discovered Conky, which is another system monitoring tool that works extremely well. One of the nice advantages to Conky is that it can operate in a window-less mode, so it persistently anchors to the desktop, preventing it from being moved or closed.

On many distributions, it's a yum or apt-get away; on Fedora 11, you would simply execute the following to install it:

# yum install conky

Once installed, copy the default configuration file (usually /etc/conky/conky.conf) to ~/.conkyrc so you may begin to customize it to suit your tastes and display the information you choose.

By default it displays the uptime, system CPU operating frequency, the number of running processes, the usage for RAM, swap, and CPU, hard drive space used, networking throughput, and the top four CPU-consuming processes.

A few nice tweaks to the defaults include setting the following options in ~/.conkyrc:

double_buffer yes
own_window_transparent yes
xftfont DejaVu Sans Mono:size=10

The first is useful if you experience window flickering in Conky as it refreshes status information; usually setting double_buffer will correct this issue. The second makes Conky transparent, so it looks as though the statistics are part of the desktop itself. Finally, changing the xftfont string can provide different fonts and smaller font sizes (the default is to use a 12pt size; setting it to 10 makes it take up less room on the desktop and is still quite readable).

The configuration file has a lot that can be added to it, allowing you to monitor many parts of your system. It can monitor POP3/IMAP mail accounts, temperature, the number of connections on specified TCP ports, fan states, battery charge, and much more. The full variable listing of what Conky supports is available on the Web site. As an example, you can make Conky monitor the number of SSH connections to the system and to display the system load average like this:

${color yellow}Load Average:$color $loadavg
${color grey}SSH connections:$color ${tcp_portmon 22 22 count}

The first displays the "Load Average" text in yellow, and then displays the load average. The second displays the number of connections on port 22. The "count" option can be replaced with others, some of which are "rip" to display the remote IP address and "rhost" to display the remote hostname.

The configuration is quite versatile and there is a lot you can monitor with Conky. Having Conky run when you login as a startup item will have it constantly available on the desktop. It also is not bound to a virtual desktop, so it is available on all of them, and does not take up any room on the panel as an active process. Finally, any users of GeekTool on OS X will find that the feel of Conky is quite similar to that versatile tool.

Get the PDF version of this tip here.

Delivered each Tuesday, TechRepublic's free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

7 comments
kandyass
kandyass

Conky is one of the first things I set up. You don't have to put everything in just one conkyrc file either. I have four of them so I can have stuff refresh at different intervals. You can have the conkyrc file call bash lua and python scripts that echo back code to be parsed by conky. I do this to display things in different colors depending on temperature etc. I understand the latest version can even use images from lua scripts.

pgit
pgit

I recently acquired a new laptop, which I promptly put Mandriva 2009.1/KDE4 on. This is the most Linux friendly machine I've ever seen. 110% perfect out of the box. It's an HP G60-441 BTW, this week 479 bux at staples. Anyway, I installed the 64 bit OS, then started messing around adding applications and seeing how well things worked. When I got around to giving conky a whirl, it apparently hosed my system. It had to be conky, it was running great, I install conky and run it, now it's not running very well at all. I eventually had to do a reinstall. Not sure what the problem was, I suspect maybe the 64 bit package. Haven't tried it on a 32 bit system, but now having seen this article I'll give it a try in the lab tomorrow.

tmcmulli
tmcmulli

I've been using conky on one of my Ubuntu desktops for a while... I rely on it so much, I added Gnome to my Ubuntu Server to get the ability to monitor via conky...

david.thor
david.thor

Gkrellm can start a daemon that you can connect to from another machine. That way you can use gkrellm as a tool to remotely monitor machines other than your own. I am not 100% sure but I think Conky can't do this.

csmith.kaze
csmith.kaze

Use it like crazy. I have a conky file that shows all the necessary items even with my dock (Docky) so I can see them even with everything maximized. Great for keeping an eye on stuff. Should search for conkyrc on google, will find a tone of forums with people posting their rc files and screenshots.

vdanen
vdanen

Hmmm.. I'm running Conky all the time on Fedora 11 64bit and no problems here whatsoever. Maybe a configuration setting, or something else? Not sure what it might be, I've not tried Mandriva 2009.1 at all.

pgit
pgit

All I did was install/run, and I didn't look very deep into what was gunking up the works. I should have because maybe I could have salvaged the system rather than reinstall. But frustration got the better of me. Testing conky on another box today...

Editor's Picks