DEV Community

Alpha Olomi
Alpha Olomi

Posted on

Conky - lightweight free system monitor

Conky

According to Wikipedia "Conky is a free software desktop system monitor for the X Window System. It is available for Linux, FreeBSD, and OpenBSD. Conky is highly configurable and is able to monitor many system variables including the status of the CPU, memory, swap space, disk storage, temperatures, processes, network interfaces, battery power, system messages, e-mail inboxes, Arch Linux updates, many popular music players (MPD, XMMS2, BMPx, Audacious, etc.), weather updates, breaking news, and much more. Unlike system monitors that use high-level widget toolkits to render their information, Conky is drawn directly in an X window. This allows it to be configured such that it consumes relatively few system resources."

Features

Conky can display more than 300 built-in objects, including support for:

  • A plethora of OS stats (uname, uptime, CPU usage, mem usage, disk usage, "top" like process stats, and network monitoring, just to name a few).
  • Built-in IMAP and POP3 support.
  • Built-in support for many popular music players (MPD, XMMS2, Audacious). Can be extended using built-in Lua support, or any of your own scripts and programs (more).
  • Built-in Imlib2 and Cairo bindings for arbitrary drawing with Lua (more).
  • Runs on Linux, FreeBSD, OpenBSD, DragonFlyBSD, NetBSD, Solaris, Haiku OS, and macOS!

1. How to install Conky

$ sudo apt install conky
Enter fullscreen mode Exit fullscreen mode

2. How to configure Conky

Default configuration file location is $HOME/.conkyrc or ${sysconfdir}/conky/conky.conf. On most systems, "sysconfdir" is /etc, and you can find the sample configuration file there (/etc/conky/conky.conf)

A very simple configuration for Conky which displays the time on a user's desktop is as follows:

update_interval 30

own_window yes
own_window_type desktop

use_xft yes
xftfont DejaVu Sans:size=14

alignment bottom_right

TEXT
${time %H:%M}
Enter fullscreen mode Exit fullscreen mode

Comments start with -- this is a comment. You can have multiline comments by using:

--[[
first comment line
second comment line
]]
Enter fullscreen mode Exit fullscreen mode

Comments starting with # can be inside conky.text = [[text section]].

In our case

We will use ${HOME}/.conkyrc as our configurtion file for conky.config and conky.text.

  • CPU core number is started from 1 (cpu0 means average of cores). Add entry of ${cpu cpuN} for your cpu cores.

  • The following command treats eth0 as network interface name. Change your network interface name of ifconfig.

$ export NETWORK_INTERFACE=wlan0
$ cat <<EOF > ~/.conkyrc
conky.config = {
use_spacer = 'left',
pad_percents = 3,
background = false,
double_buffer = true,
font = 'DejaVu Sans Mono:size=10',
use_xft = true,
alignment = 'top_right',
gap_x = 10,
gap_y = 40,
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',
own_window = true,
update_interval = 5.0,
}
conky.text = [[
\${color orange}Hostname: \${color}\${nodename}
\${color orange}Kernel: \${color}\${sysname} \${kernel} on \${machine}
\${color orange}Uptime:
\${hr} \${color}\${uptime}
\${color orange}CPU:\${color} \${freq_g} GHz
\${color orange}1:\${color} \${cpu cpu1}% \${cpubar cpu1}
\${cpugraph}
\${color orange}Name            PID                 CPU%        MEM%
\${color lightgrey} \${top name 1} \${top pid 1} \${top cpu 1} \${top mem 1}
\${color lightgrey} \${top name 2} \${top pid 2} \${top cpu 2} \${top mem 2}
\${color lightgrey} \${top name 3} \${top pid 3} \${top cpu 3} \${top mem 3}
\${color lightgrey} \${top name 4} \${top pid 4} \${top cpu 4} \${top mem 4}
\${color orange}Load average: \${color}\${loadavg}
\${color orange}Processes: \${color}\${processes} \\
\${color orange}Running:\${color} \${running_processes}
\${hr}
\${color orange}RAM:
\${color}\${mem}/\${memmax}
\${memperc}% \${membar 4}
\${color orange}Swap: \${color}\${swap}/\${swapmax}
\${swapperc}% \${swapbar 4}
\${memgraph}
\${hr}
\${color orange}/ \${color}\${fs_used /}/\${fs_size /} \${fs_bar 6 /}
\${hr}
\${color orange}IP:
\${color orange}Up:
\${color}\${addr ${NETWORK_INTERFACE}}
\${color}\${upspeed ${NETWORK_INTERFACE}}
\${color orange}Down: \${color}\${downspeed ${NETWORK_INTERFACE}}
]]
EOF
Enter fullscreen mode Exit fullscreen mode

3. How to make Conky auto-start on start up

Use X-MATE-Autostart-enabled=true if your using Mate Desktop Environment

# create config directory
$ mkdir -p ~/.config/autostart

# create

$ cat <<EOF > ~/.config/autostart/conky.desktop
[Desktop Entry]
Type=Application
Exec=/usr/bin/conky
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=conky
Comment=
EOF
Enter fullscreen mode Exit fullscreen mode

4. Finally Reboot

$ sudo reboot
Enter fullscreen mode Exit fullscreen mode

For more information visit https://github.com/brndnmtthws/conky/wiki

Screenshots of working conky

Arch Linux

Ubuntu Conky

Credits and Acknowledgments

  1. Screenshots by Wikipedia

Top comments (0)