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!


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.

Editor's Picks