Special Offers

Feature: Tools & Utilities

Expert's guide to configuring Conky

When it comes to monitoring your Linux system, few tools can rival Conky. This lightweight system monitoring utility can help you to keep an eye on virtually any aspect of your system, and it offers a huge list of options to choose from. But this flexibility comes at a price: all Conky's settings are stored in the .conkyrc file, which you have to create and tweak manually. The good news is that once you understand the inner workings of the .conkyrc file, you can easily create powerful Conky configuration profiles.

The .conkyrc file consists of two sections: the first controls Conky's appearance, while the second determines what data to monitor. To separate these sections, Conky uses the TEXT marker. Since the .conkyrc file is just a plain text file, you can use your favorite text editor to work with it.

The first thing you have to do is specify the update interval, or how often Conky "collects" the monitored data. Specify the update_interval option in seconds; for example, update_interval 1.0 or update_interval 3.0. Obviously, the exact value depends on how up-to-date you need your data to be. On my Eee PC, changing the update interval doesn't seem to have any adverse effect on the performance, so I usually set it to 1 second.

This often causes Conky to flicker, which can be annoying. Conky has two options to help you to deal with this problem. The double_buffer setting lets Conky use the X double-buffer extension, which can eliminate flickering. If enabling double_buffer doesn't help, you can use the own_window option, which forces Conky to run in a separate window. To enable these options, add them to the .conkyrc file:

double_buffer yes
own_window yes

By default, Conky uses a monospaced font, but you can instruct it to use any font installed on your system by specifying the use_xft option followed by the xftfont setting. For example, if you wanted Conky to use the Bitstream Vera Sans 8pt font, the options would look like this:

use_xft yes
xftfont Bitstream Vera Sans:size=8

The next step is to specify the Conky window's settings, including its width, alignment, and default color. In the example below, the window width is set to 270 pixels, it uses white as its default color, and it is aligned to the top left corner.

maximum_width 270
default_color white
alignment top_right

If you don't want text in the Conky window to appear in all caps, use the uppercase option:

With the basic display options in place, you can start working on what system parameters you want Conky to monitor by using so-called variables. For example, to display the kernel version of your system, you can use the kernel variable, and if you want Conky to show the hostname, you can do this by adding the nodename variable:

$nodename - $kernel

Note that each variable in the .conkyrc file is preceded by a $ sign. Conky also includes a few variables that allow you to control the appearance of the output. The color variable lets you specify text color, while the alignr variable allows you to right-justify text. To see how this works in practice, take a look at the following example:

The ${color lightgrey} sets the text color to light gray. To switch back to the default color (white), you can use the color variable without any parameter. As the name suggests, the uptime variable displays your machine's uptime. As you can see from the example, you can combine several variables to achieve the desired effect. In this case, the $alignr${color lightgrey} variables are used to set color and right-justify text for the word "Load:" and the output of the loadavg variable, which displays the average processor load. In a similar manner, you can specify variables that display processor speed and CPU usage:

Conky also allows you to visualize monitored data using graphs. The cpugraph variable, for example, displays the CPU usage as a graph. When used without any parameters, the graph is shown using default solid color, but you can use hex color values to specify gradients, which make the graph look much better:

${cpugraph 000000 ffffff}

You can use the memory-related variables to display the total amount of RAM (memmax), amount of memory in use (mem), and percentage of memory in use (memperc):

${color lightgrey}RAM usage:$color $mem/$memmax - $memperc%

You can also display these data as a bar graph using the membar variable: ${membar}.

When it comes to monitoring disk usage, you have a few variables to choose from, including fs_free (free space), fs_size (total size), and fs_bar (spaced used bar):

Finally, let's take a look at the variables that allow you to monitor wireless network connections. First, you have to find out the name of the network interface you want to monitor. To do this, you can use the bash ifconfig command, which returns a list of available network interfaces. Conky has quite a few variables that you can use to monitor the wireless connection, including:

wireless_essid (returns the ESSID name of the access point)

wireless_mode (returns the wireless mode, e.g. Managed/Ad-Hoc/Master)

wireless_bitrate (returns bitrate or speed, e.g. 11Mb/s)

wireless_link_qual (returns wireless link quality)

wireless_link_qual_perc (returns wireless link quality in percents)

wireless_link_bar (returns the wireless link quality displays as a bar)

Here is an example of how these variables can be used in the .conkyrc file:

If you want to monitor download and upload speeds, you can use the downspeedf and upspeedf variables (or downspeed and upspeed if you don't want to display the trailing decimal):

${color lightgrey}Download speed: $color${downspeedf wifi0} Kb/sec

There are also the downspeedgraph and upspeedgraph variables, which can display the download and upload speeds as graphs. And if you want to monitor the total amount of downloaded and uploaded data (handy if you are using a connection where you pay for transfered data), then you can use the totaldown and totalup variables:

Expert's guide to configuring Conky

Posted by: Anonymous
[ip: 216.48.59.163]
on June 03, 2008 07:14 PM

Yeah i was able to tolerate the flicker only so much. I switched back to gkrellm because of that and used the invisible theme. I liked conky cause of all the options and settings and little things i could add and customize but when i turned on double buffer is messed my xfce4 desktop up and cause the icons to dissapear. It did get rid of the flickering with conky though. And i dont want to run conky in its own window, i want it to look embeded in the desktop. Oh well maybe the nvidia, xfce, and conky gods will all work together harmoniously.

Expert's guide to configuring Conky

Posted by: Anonymous
[ip: 212.84.98.122]
on June 05, 2008 09:18 AM

Really good article Dimitri, nice and concise. I recently posted something similar on my blog at http://reddevil62-techhead.blogspot.com/, though my piece rambled a bit more than yours. I'm now using Conky on my main machine which runs Linux Mint 4.0 with Fluxbox as my window manager and it's a great combination - Conky for the details, Fluxbox for speed and Ubuntu repos for lots of applications. Thanks again for the article.