wiki.allensmith.net

Personal "Rough Notes & Useful Links

User Tools

Site Tools


kb:linux:conky

Conky System Monitor

Install Conky with System Monitor Packages

Ubuntu 14.04 based Linux: Install Conky

  • From the Terminal run the following commands:

      sudo apt-get install conky-all curl hddtemp lm-sensors
      sudo apt-get install ttf-liberation ttf-dejavu     # these fonts might already be installed
      sudo chmod u+s /usr/sbin/hddtemp
<div markdown="1" class="notetip">Apparently with the KDE Desktop (at least with Mint 17.1 KDE) the <tt>lm-sensors</tt> package was already installed. So only in that situation, there would be no need to run the following command. (Do **not** try to setup lm-sensors a second time.)</div>
  • The following command will configure the lm-sensors package:

      sudo sensors-detect
  • For the (<tt>sensors-detect</tt>) command, answer all questions with "yes" -- including the last question.

RESTART SYSTEM ← to finish installing this and get everything running correctly

Ubuntu 12.04 based Linux: Install Conky

  • From the Terminal run the following commands:

      sudo apt-get install conky-all curl hddtemp lm-sensors python-statgrab
      sudo chmod u+s /usr/sbin/hddtemp
      sudo sensors-detect
    • For the last (<tt>sensors-detect</tt>) command, answer all questions with "yes" -- including the last question.

RESTART SYSTEM ← to finish installing this and get everything running correctly

Starting & Restarting Conky Reliably

With the Xfce Desktop, using the "Save session for future logins" option (on the Logout Screen) does not always start up Conky the next time the system boots and is logged into. When Conky does not start up, it needs to be manually run (using Alt-F2, then typing in the command to run Conky) to get it going again.

On the other hand, adding an entry for Conky to the Application Autostart list can result in an additional copy of Conky running each time the system is restarted.

I have seen all of the above using the Xfce Desktop-- but similar situations might occur with other desktops.

<p markdown="1" class="noteclassic">The following configuration makes use of a Conky startup script to ensure that **only** a single instance of the desired Conky is running. … Adjust the below 5 second then 10 second delays as needed for your system.</p>
  • From the Terminal run the following commands:

      mkdir ~/.conky    # create a hidden directory for conky
      nano ~/.conky/conkystart.sh    # copy & past the following text into this empty file
~/.conky/conkystart.sh
#!/bin/bash
# Pause to let the system start
# Then stop any old conky processes that are still running
sleep 5 && killall conky
# Pause a little longer to maker certain the desktop is fully loaded
# Then start the desired conky
sleep 10 && conky -c ~/.conky/conkyrc_sys
# uncomment the following line to run the Google Calendar conky
# sleep 10 && conky -c ~/.conky/conkyrc_gcalcli
  • Now run the following to set the permissions on the above file to permit it to be run as a script:

      chmod +x ~/.conky/conkystart.sh    # needed file permission to run this script

Now the .conkyrc configuration file that you would like to use with Conky System Monitor should be saved as conkyrc_sys in the just created .conky directory. ( <tt>~/.conky/conkyrc_sys</tt> )

<div markdown="1" class="notetip">**Tip:** If the desired Conky configuration file already exists (as <tt>.conkyrc</tt>), then just run the below terminal command to move that configuration to <code>.conky/conkyrc_sys</code> ~~~~ mv ~/.conkyrc ~/.conky/conkyrc_sys # move existing .conkyrc file into .conky directory ~~~~ </div>

Finally update the Autostart list to use the above Conky startup script, to ensure that only one instance of the desired Conky will be running.

For the Xfce desktop

  • Xfce "Menu" icon » "Settings" » "Session and Startup" » the "Application Autostart" tab
    • If there is an existing Startup item listed for Conky, then select and Remove that.
    • Add a Startup Item for Conky using the following information:
      • Name: <tt>Conky System Monitor</tt>
      • Command: <code>/home/[user]/.conky/conkystart.sh</code> ← Replace "<tt>[user]</tt>"with the login user name
<p markdown="1" class="noteclassic">**Noie:** How an autostart item is created with other desktops should be similar to the above. Instructions for the other Ubuntu and Linux Mint desktops will be added as I do this for each of those desktops.</p>

Sample Conky System Monitor Configuration

The Conky Configuration File I Use

The .conkyrc configuration file that I originally used on my workstation computer

  • To use this directly without a startup script, save this hidden file to <tt>~/.conkyrc</tt> (use Alt-F2 then just type "<code>conky</code>" to run this)
  • To use the above startup script (highly recommended), save this file to <tt>~/.conky/conkyrc_sys</tt><p markdown="1" class="noteclassic">**Note:** Instructions on the Internet refer to this configuration file as the "<tt>.conkyrc</tt> file" -- so that is what will be used in the other parts of this document, when referring to this file in a **generic** manner.</p>
~/.conky/conkyrc_sys
######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
if_up_strictness link
 
imlib_cache_size 0
double_buffer yes
no_buffers yes
 
format_human_readable
 
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Liberation Sans:size=8
override_utf8_locale yes
text_buffer_size 2048
 
#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type normal
own_window_transparent no
own_window_argb_visual yes
own_window_argb_value 128
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
 
# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
 
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 30
gap_y 64
 
## Use double buffering (reduces flicker, may not work for everyone)
#double_buffer yes
 
# Minimum size of text area
 
minimum_size 182 600
maximum_width 182
 
# Draw shades?
draw_shades no
 
# Draw outlines?
draw_outline no
 
# Draw borders around text
draw_borders no
 
# Stippled borders?
stippled_borders 0
 
# border margins
border_margin 5
 
# border width
border_width 1
 
# Default colors and also border colors
default_color white
#default_shade_color black
default_outline_color white
own_window_colour black
color0 white
color1 70CC37
color2 white
color3 FCAF3E
 
default_bar_size 60 8
 
# Subtract file system buffers from used memory?
no_buffers yes
 
# set to yes if you want all text to be in uppercase
uppercase no
 
# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer none
 
TEXT
SYSTEM $stippled_hr
${goto 6}${voffset 6}${font OpenLogos:size=32}t${font}${goto 36}${voffset -32}${font Liberation Sans:style=Bold:size=8}${pre_exec cat /etc/issue.net} $machine${font}
${goto 36}  Kernel: ${kernel}
${voffset 2}${goto 40}${alignr}Uptime: ${uptime}
${color1}$stippled_hr${color}
# |--Nvidia GPU
${voffset 4}${goto 6}${font ConkyColors:size=16}e${font}${voffset -10}${goto 32}Nvidia GPU speed:${font Liberation Sans:size=9}${alignr}${color1}${nvidia gpufreq} MHz${color}${font}
${voffset -2}${goto 32}GPU temperature:${font Liberation Sans:style=Bold:size=10}${alignr}${color3}${nvidia temp} °C${color}${font}
# |--CPU
${voffset 2}${goto 6}${font ConkyColors:size=16}e${font}${voffset -10}${goto 32}CPU1: ${font Liberation Sans:style=Bold:size=9}${color1}${cpu cpu0}%${font}  ${alignr}${color2}${cpugraph cpu0 12,80 709937 51751E}
${voffset -2}${goto 32}CPU2: ${font Liberation Sans:style=Bold:size=9}${color1}${cpu cpu1}%${font}  ${alignr}${color2}${cpugraph cpu1 12,80 709937 51751E}
${voffset -2}${goto 32}CPU temperature:${font Liberation Sans:style=Bold:size=10}${alignr}${color3}${hwmon 1 temp 1} °C${color}${font}
# |--PROC
${goto 6}${voffset -4}${font ConkyColors:size=16}E${font}${voffset -2}${goto 32}Processes: ${alignr}$processes ($running_processes running)
${goto 7.5}${voffset 4}${font Poky:size=15}a${font}${goto 32}${voffset -10}Highest: ${alignr 13}CPU${alignr}RAM
${goto 32}${voffset -5.5}${hr 1}
${voffset -1}${goto 32}${top name 1} ${goto 124}${top cpu 1}${alignr }${top mem 1}
${voffset -1}${goto 32}${top name 2} ${goto 124}${top cpu 2}${alignr }${top mem 2}
${voffset -1}${goto 32}${top name 3} ${goto 124}${top cpu 3}${alignr }${top mem 3}
${voffset -1}${goto 32}${top name 4} ${goto 124}${top cpu 4}${alignr }${top mem 4}
# |--MEM
${goto 6}${voffset 4}${font ConkyColors:size=13}g${font}${voffset -4}${goto 32}RAM: ${font Liberation Sans:style=Bold:size=9}${color1}$memperc%${color}${font} ${alignr}${membar 6,80}
# |--SWAP
${goto 6}${voffset 0}${font ConkyColors:size=13}g${font}${voffset -4}${goto 32}Swap: ${font Liberation Sans:style=Bold:size=9}${color1}$swapperc%${color}${font} ${alignr}${swapbar 6,80}
# |-- Disk I/O
${goto 2}${voffset -2}${font Poky:size=15}H${font}${voffset -4}${goto 28}Disk: ${font Liberation Sans:style=Bold:size=9}${color1}${diskio}${color}${font}${alignr}${voffset -6}${diskiograph 12,80 F57900 FCAF3E}
# |-- HDD Temp
${goto 4.5}${voffset 8}${font Poky:size=15}y${font}${voffset -6}${goto 32}sda HDD temperature:${font Liberation Sans:style=Bold:size=9}${alignr}${color3}${exec hddtemp /dev/sda -n –unit=C} °C${color}${font}
${goto 4.5}${voffset -2}${font Poky:size=15}y${font}${voffset -6}${goto 32}sdb HDD temperature:${font Liberation Sans:style=Bold:size=9}${alignr}${color3}${exec hddtemp /dev/sdb -n –unit=C} °C${color}${font}
${goto 4.5}${voffset -2}${font Poky:size=15}y${font}${voffset -6}${goto 32}sdc HDD temperature:${font Liberation Sans:style=Bold:size=9}${alignr}${color3}${exec hddtemp /dev/sdc -n –unit=C} °C${color}${font}
 
Time & Date $stippled_hr
${voffset -12}${font Arial Black:size=26}${alignc}${font Arial Black:size=16}  ${font Arial Black:size=26}${time %l:%M}${font Arial Black:size=16}${time %p}${font}${font}${font}${font}
${font Liberation Sans:size=10}${alignc}${time %A, %B %d, %Y}${font}
 
HDD Partitions $stippled_hr
# |-- HDD
${font Poky:size=16}y${font} ${voffset -8}File System ${voffset 4}${font Liberation Sans:style=Bold:size=8}${alignr}${color3}${fs_used /}${color} / ${color1}${fs_free /}${color}${font}
${fs_size /}${alignr}${fs_bar 6,120 /}
${voffset -2}${font Poky:size=16}y${font} ${voffset -8}Home ${voffset 4}${font Liberation Sans:style=Bold:size=8}${alignr}${color3}${fs_used /home}${color} / ${color1}${fs_free /home}${color}${font}
${fs_size /home}${alignr}${fs_bar 6,120 /home}
 
${voffset -4}Network Interfaces $stippled_hr
# |–- Network Interfaces
${voffset -2}${if_up eth0}
${voffset -6}${font Liberation Sans:style=Bold:size=9}eth0: ${alignr}${color1}${addr eth0}${color}${font}
${voffset -5}${font VariShapes Solid:size=14}q${font}${goto 24}${voffset -10}Up: ${font Liberation Sans:style=Bold:size=9}${color3}${upspeed eth0}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totalup eth0}${font} ${alignr}${voffset -6}${upspeedgraph eth0 12,80 F57900 FCAF3E}
${voffset 8}${font VariShapes Solid:size=14}Q${font}${goto 24}${voffset -14}Down: ${font Liberation Sans:style=Bold:size=9}${color1}${downspeed eth0}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totaldown eth0}${font} ${alignr}${voffset -6}${downspeedgraph eth0 12,80 F57900 FCAF3E}
${endif}${if_up eth1}
${voffset -6}${font Liberation Sans:style=Bold:size=9}eth1: ${alignr}${color1}${addr eth1}${color}${font}
${voffset -5}${font VariShapes Solid:size=14}q${font}${goto 24}${voffset -10}Up: ${font Liberation Sans:style=Bold:size=9}${color3}${upspeed eth1}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totalup eth1}${font} ${alignr}${voffset -6}${upspeedgraph eth1 12,80 F57900 FCAF3E}
${voffset 8}${font VariShapes Solid:size=14}Q${font}${goto 24}${voffset -14}Down: ${font Liberation Sans:style=Bold:size=9}${color1}${downspeed eth1}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totaldown eth1}${font} ${alignr}${voffset -6}${downspeedgraph eth1 12,80 F57900 FCAF3E}
${endif}${if_up wlan0}
${voffset -6}${font Liberation Sans:style=Bold:size=9}wlan0: ${alignr}${color1}${addr wlan0}${color}${font}
${voffset -5}${font VariShapes Solid:size=14}q${font}${goto 24}${voffset -10}Up: ${font Liberation Sans:style=Bold:size=9}${color3}${upspeed wlan0}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totalup wlan0}${font} ${alignr}${voffset -6}${upspeedgraph wlan0 12,80 F57900 FCAF3E}
${voffset 8}${font VariShapes Solid:size=14}Q${font}${goto 24}${voffset -14}Down: ${font Liberation Sans:style=Bold:size=9}${color1}${downspeed wlan0}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totaldown wlan0}${font} ${alignr}${voffset -6}${downspeedgraph wlan0 12,80 F57900 FCAF3E}
${endif}${if_up wwan0}
${voffset -6}${font Liberation Sans:style=Bold:size=9}wwan0: ${alignr}${color1}${addr wwan0}${color}${font}
${voffset -5}${font VariShapes Solid:size=14}q${font}${goto 24}${voffset -10}Up: ${font Liberation Sans:style=Bold:size=9}${color3}${upspeed wwan0}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totalup wwan0}${font} ${alignr}${voffset -6}${upspeedgraph wwan0 12,80 F57900 FCAF3E}
${voffset 8}${font VariShapes Solid:size=14}Q${font}${goto 24}${voffset -14}Down: ${font Liberation Sans:style=Bold:size=9}${color1}${downspeed wwan0}${color}${font}${goto 24}${voffset 12}Total: ${font Liberation Sans:style=Bold:size=8}${totaldown wwan0}${font} ${alignr}${voffset -6}${downspeedgraph wwan0 12,80 F57900 FCAF3E}
${endif}
 
# |-- PublicIP
${voffset -12}${font Poky:size=13}w${font}${goto 32}${voffset -6}${font Liberation Sans:style=Bold:size=9}Public IP: ${alignr}${color3}${curl ifconfig.me}${color}${font}

Note: The above configuration is for an old Gaming PC that was build using an AMD Athlon 64 X2 CPU, an ASUS motherboard and an Nvidia graphics card.

<p markdown="1" class="noteimportant">Different motherboards, video cards and CPUs could require a different coding for the GPU and CPU section of the above configuration script. (What I often need to "**fix**" in the above script.)</p>

Different GPU and CPU sections example: an Intel Core2Duo CPU in an HP desktop PC that does not use Nvidia Graphics <pre>

|--Nvidia GPU

${voffset 4}${goto 6}${font ConkyColors:size=16}e${font}${voffset -10}${goto 32}Nvidia GPU speed:${font Liberation Sans:size=9}${alignr}${color1}${nvidia gpufreq} #MHz${color}${font}

${voffset -2}${goto 32}GPU temperature:${font Liberation Sans:style=Bold:size=10}${alignr}${color3}${nvidia temp} °C${color}${font}

|--CPU

${voffset 4}${goto 6}${font ConkyColors:size=16}e${font}${voffset -10}${goto 32}CPU1: ${font Liberation Sans:style=Bold:size=9}${color1}${cpu cpu0}%${font} ${alignr}${color2}${cpugraph cpu0 12,80 709937 51751E}

${voffset 0}${goto 32}CPU frequency:${alignr}${color1}${freq_g 1} GHz${color}

${voffset -2}${goto 32}CPU2: ${font Liberation Sans:style=Bold:size=9}${color1}${cpu cpu1}%${font} ${alignr}${color2}${cpugraph cpu1 12,80 709937 51751E} ${voffset 0}${goto 32}CPU frequency:${alignr}${color1}${freq_g 2} GHz${color} ${voffset -2}${goto 32}CPU temperature:${font Liberation Sans:style=Bold:size=10}${alignr}${color3}${hwmon 1 temp 3} °C${color}${font} </pre>

Install the Symbol TrueType Fonts

<p markdown="1" class="noteclassic">To keep things "simple" and light-weight, I use several symbol fonts instead of graphic in my <tt>.conkyrc</tt> file. So the below notes explain how I install the fonts, that the above Conky configuration script needs, when using Ubuntu LTS based Linux. </p>

conkyttf.zip (110KB) … the free TrueType fonts that I use with Conky instead of Graphics with the above Configuration File.

<p markdown="1" class="noteimportant">**Note**: The following instructions assumes the **extracted** "<tt>conkyttf</tt>" folder is in the "<tt>Downloads</tt>" directory for the current user.</p>
  • To install these fonts for only the current user, I use the following:

      mkdir ~/.fonts
      cp ~/Downloads/conkyttf/*.ttf ~/.fonts
      sudo fc-cache -f -v
  • Or to install these fonts for all users on the system, I use the following:

      sudo mkdir /usr/share/fonts/truetype/conky
      sudo cp ~/Downloads/conkyttf/*.ttf /usr/share/fonts/truetype/conky/
      sudo fc-cache -f -v
kb/linux/conky.txt · Last modified: 2016/01/13 20:35 (external edit)