Kaveh's Blog logo

Personal blog

Kaveh Tehrani

Live Monitoring Linux With Conky

Published on
|
3 mins read

Conky is my favorite tool for live monitoring my ubuntu machines (Github repo here). It is a light, performant, and highly customizable tool that usually peaks on the side of my second screen, so I can quickly keep an eye on most system's resources.

Conky system monitor widget showing CPU, memory, disk, and network stats on desktop

Config File

Here's my config file below which displays what I need with minimal overhead. Feel free to take it and use it for your needs by editing the configuration file: /etc/conky/conky.conf

The documentation for conky is excellent and be found here.

conky.config = {
    use_xft = true,
    xftalpha = 0.8,
    update_interval = 1.0,
    total_run_times = 0,
    own_window = true,
    own_window_transparent = true,
    own_window_argb_visual = true,
    own_window_type = 'normal',
    own_window_class = 'conky-semi',
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
    background = false,
    double_buffer = true,
    imlib_cache_size = 0,
    no_buffers = true,
    uppercase = false,
    cpu_avg_samples = 2,
    override_utf8_locale = true,

    -- placement
    alignment = 'top_right',
    gap_x = 5,
    gap_y = 25,
    xinerama_head = 0,

    -- default drawing
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = true,
    default_bar_width = 150, default_bar_height = 5,
    default_graph_width = 150, default_graph_height = 12,
    default_gauge_width = 20, default_gauge_height = 20,

    -- colors
    font = 'Liberation Mono:size=10',
    default_color = 'EEEEEE',
    color1 = 'a3c1e3',
    color2 = 'FF993D',
    color3 = 'AAAAAA',

    -- layouting
    template0 = [[${font Liberation Sans:bold:size=11}${color2}\1 ${color3}${hr 2}${font}]],
    template1 = [[${color1}\1]],
    template2 = [[${goto 100}${color}]],
    template3 = [[${goto 180}${color}${alignr}]],
};

conky.text = [[
${template0 System}
${template1 Hostname}                                                       ${template3}${nodename}
${template1 ${sysname}}                                                     ${template3}${kernel}-${machine}
${template1 Uptime}                                                         ${template3}${uptime_short}

${template0 Processors}
${template1 CPU Load/Temp}                                                  ${template3}${freq_g}GHz - ${acpitemp}°C
${template1 Load}               ${template2}${loadavg 1}                    ${template3}${cpugraph}
${template1 Core\ 1}            ${template2}${cpu cpu1}%                    ${template3}${cpubar cpu1}
${template1 Core\ 2}            ${template2}${cpu cpu2}%                    ${template3}${cpubar cpu2}
${template1 Core\ 3}            ${template2}${cpu cpu3}%                    ${template3}${cpubar cpu3}
${template1 Core\ 4}            ${template2}${cpu cpu4}%                    ${template3}${cpubar cpu4}
${template1 Proc/Thrds}	        ${template2}${processes}                    ${template3}${threads}
${template1 Top1}               ${template2}${top name 1}                   ${template3}${top cpu 1}
${template1 Top2}               ${template2}${top name 2}                   ${template3}${top cpu 2}
${template1 Top3}               ${template2}${top name 3}                   ${template3}${top cpu 3}

${template0 Memory}
${template1 Memory}             ${template2}${memperc}% used                ${template3}${mem} / ${memmax}
                                                                            ${template3}${membar}
${template1 Top1}               ${template2}${top_mem name 1}               ${template3}${top_mem mem_res 1}
${template1 Top2}               ${template2}${top_mem name 2}               ${template3}${top_mem mem_res 2}
${template1 Top3}               ${template2}${top_mem name 3}               ${template3}${top_mem mem_res 3}

${template0 Filesystem}
${template1}${fs_type}          ${template2}${fs_free /} free               ${template3}${fs_used /} / ${fs_size /}
                                                                            ${template3}${fs_bar /}
${template1 IO\ Read}           ${template2}${diskio_read}                  ${template3}${diskiograph_read}
${template1 IO\ Write}          ${template2}$diskio_write                   ${template3}$diskiograph_write
${template1 Top1}               ${template2}${top_io name 1}                ${template3}${top_io io_perc 1}%
${template1 Top2}               ${template2}${top_io name 2}                ${template3}${top_io io_perc 2}%
${template1 Top3}               ${template2}${top_io name 3}                ${template3}${top_io io_perc 3}%

${template0 Networking}
${if_existing /proc/net/route wlp2s0}\
${template1 IP pub/pri}                                                     ${template3}${execi 600 curl ipinfo.io/ip} | ${addr wlp2s0}
${template1 AP}                                                             ${template3}${wireless_essid wlp2s0}
${template1 Signal}             ${template2}${wireless_link_qual_perc wlp2s0} ${template3}${wireless_link_bar wlp2s0}
${template1 Download}           ${template2}${downspeed wlp2s0}             ${template3}${downspeedgraph wlp2s0}
${template1 Upload}             ${template2}${upspeed wlp2s0}               ${template3}${upspeedgraph wlp2s0}
${template1 Total Down/Up}                                                  ${template3}${totaldown wlp2s0}↓  ${totalup wlp2s0}↑
${else}${if_existing /proc/net/route eth0}\
${template1 Ip}                                                             ${template3}${addr eth0}
${template1 Download}           ${template2}${downspeed eth0}               ${template3}${downspeedgraph eth0}
${template1 Upload}             ${template2}${upspeed eth0}                 ${template3}${upspeedgraph eth0}
${template1 Total Down/Up}                                                  ${template3}${totaldown eth0}↓/${totalup eth0}↑
${endif}${endif}\
 ]];

If you have an AMD, you might have to replace the line above to show your temperature with below:

${template1 CPU\ Load/Temp}                                                 ${template3}${freq_g}GHz - ${hwmon 3 temp 1}°C

Run on Startup

If you want conky to run upon start up, you can add it as a startup application by adding this command: conky -p 15. Note that the 15-seconds pause is likely necessary on startup because your GUI takes some time to load before conky can properly load.