Ubuntu 17.04: Install conky for desktop system monitor

This article will describe installing conky which is a system monitor tool running as desktop widget.

1 Install conky

Install conky package.

$ sudo apt install -y conky

2 ${HOME}/.conkyrc

${HOME}/.conkyrc is config file for conky.config and conky.text. You can also use /etc/conky/conky.conf.

  • 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 ens3 as network interface name. Change your network interface name of ifconfig.

2.1 Always foreground .conkyrc

$ export NETWORK_INTERFACE=ens3
$ cat <<EOF > ~/.conkyrc
conky.config = {
  use_spacer = 'left',
  pad_percents = 3,
  background = true,
  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 = 100,
  own_window_type = 'dock',
  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:   \${color}\${uptime}
\${exec /usr/lib/update-notifier/apt-check --human-readable}
\${hr}
\${color orange}CPU:\${color} \${freq_g} GHz
\${color orange}0:\${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}\${addr ens3}
\${color orange}Up:   \${color}\${upspeed ens3}
\${color orange}Down: \${color}\${downspeed ens3}
]]
EOF

2.2 Always background .conkyrc

$ export NETWORK_INTERFACE=ens3
$ 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:   \${color}\${uptime}
\${exec /usr/lib/update-notifier/apt-check --human-readable}
\${hr}
\${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}\${addr ${NETWORK_INTERFACE}}
\${color orange}Up:   \${color}\${upspeed ${NETWORK_INTERFACE}}
\${color orange}Down: \${color}\${downspeed ${NETWORK_INTERFACE}}
]]
EOF

3 Autostart

Make conky to be start automatically on login. You can use gnome-display-properties instead of the following command.

$ mkdir -p ~/.config/autostart
$ 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

Reboot machine.

$ sudo reboot

4 Execution result

The conky widget is displayed on desktop.

0001_conky.png