Viewing system information with Conky

Slashdot it! Delicious Share on Facebook Tweet! Digg!
Lead Image © Vladyslav Starozhylov, 123RF.com

Lead Image © Vladyslav Starozhylov, 123RF.com

Attentive Observer

What's going on in your system? The lightweight Conky system monitor clearly summarizes comprehensive information on the desktop.

Modern desktops try to make the user's work with the computer as pleasant as possible. In the short term, you reach only for the PC features that you really need in daily life, and developers mostly hide the detailed information about the system. However, if you need quick information about the free space on a hard drive, for example, you'll likely have search for the information.

That's where the Conky [1] system monitor comes in handy. It displays just about all the information you need in a desktop widget (Figure 1). You can configure the display as you like and position it anywhere on the desktop.

Figure 1: Right after installation, and with no more than basic configuration, Conky is ready to provide helpful information about your system.

Conky doesn't come with a graphical interface for configuration, and you need a configuration file to adjust the application. However, the additional conky-colors script lets you enter configuration commands without having to edit the file manually.

From a terminal, use the conky command to start the program. Conky looks somewhat busy in its basic configuration (Figure  1), so customizing it is a natural first step.

You don't need to start from scratch, though – just use the /etc/conky/conky.conf system-wide configuration file as a basis for further customization by copying the file to your user directory, renaming it .conkyrc , and then opening it in your favorite text editor.

Manual Adjustments

The configuration file is divided into two parts. One part contains program parameters, such as the desktop window size and the colors and frames used. The second part, introduced by the simple keyword TEXT , is where you configure what data the application outputs.

In testing, the Conky display flickered after startup if a window was on top of it. If this happens to you, add the double_buffer yes line to the first part of the configuration file. If this doesn't fix the problem, you can always have Conky operate in a separate window. To do this, enter the line own_window yes in the configuration file. After saving the file, the software usually detects a change in the configuration file. If not, restart Conky.

As you can see from the aforementioned configuration settings, each individual setting is made up by a name-value pair. Using the options, it's easy to customize the system monitor visually to your needs. You can dramatically change its look with just a few settings.

The settings in Listing 1 make Conky look like Figure 2. With own_window_transparent yes , you can make the widget semi-transparent, in which case the software adds an image of the desktop wallpaper behind it. To customize the font, use use_xft yes and xftfont Arial . You can use any font installed on the system.

Listing 1

Appearance

01 alignment bottom_right
02 gap_x 40
03 gap_y 40
04 use_xft yes
05 xftfont Arial
06 own_window_transparent yes
Figure 2: With just a few simple steps in Conky, you can make visual adjustments to your desktop.

The alignment option lets you set the widget's position on the desktop. In the example, it's set to bottom_right . The values after gap_x and gap_y specify the widget's distance from the screen edge, which is 40 pixels in the example. Other options are listed in Table 1, with the complete list of options given on the website [2].

Apart from display options, you can add specific output options to the TEXT part of the configuration file, such as the number of new email messages or the temperature units. A description for some of these options is shown in Table 2, with a complete list on the web [3].

Customizing Output

The Conky output options are set in the TEXT part of the .conkyrc configuration file. Apart from basic information about the system (e.g., processor, hard disk, and main memory utilization), Conky can also report on such things as battery usage, IP addresses, component temperatures, RSS feeds, and mail notifications. Listing 2 details an example of one solution, with the corresponding display shown in Figure 3.

Listing 2

Displayed Information

01 TEXT
02 $alignr ${color grey}System Data $color
03 Processor $color $hr
04 ${color grey}CPU Clock Rate:$color $freq_g GHz
05 ${color grey}CPU Usage:$color ${cpubar 12,100} $cpu%
06
07 Hard Disk $color $hr
08 $color${fs_used /} of ${fs_size /} used - ${fs_used_perc /}%
09 ${fs_bar 12 /}
10
11 RAM $color $hr
12 $mem of $memmax used - $memperc%
13 ${membar 12}
Figure 3: With very little effort, Conky shows you customized information on the screen.

Variables are used for outputting values, as indicated by dollar signs, such as $machine . Assigning option-value pairs requires curly braces, such as ${color grey} .

CPU usage is displayed via the $cpu variable, which shows the value as a percentage by default for all processors. To output a value for a specific processor, add the CPU number to the variable, such as ${cpu cpu1} for the first processor.

To make the percentage values more pronounced, Conky provides several graphical elements. Among these are bar charts that you can activate with the $cpubar variable. By entering height and width values, you can tell the program what size to make the bar. Specifying ${cpubar 12,100} outputs the bar with a height of 12 pixels and a width of 100 pixels.

Output of hard disk usage is through the $fs_used variable. Combined with $fs_size , it generates output about the ratio of total disk space to that actually used (line 8 in Listing 2).

By including a slash for the root filesystem (${fs_used /} ), the program evaluates the mounted filesystem at the corresponding spot. As with processor details, Conky can also display the hard drive data as a bar if you specify the $fs_bar variable.

Main memory output uses similar variables. Use $mem and $memmax to show the actual memory used compared with the maximum available, and the $membar variable displays it as a bar.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content