Skip to main content

System Monitoring Ubuntu with Conky

sudo apt install conky-all

https://help.ubuntu.com/community/SettingUpConky
https://linuxconfig.org/system-monitoring-on-ubuntu-18-04-linux-with-conky

enable conky to automaticaly start at the boot:
Open Startup Applications Preferences from Activities.
Click Add
Name: Conky System Monitoring
Command: /usr/bin/conky
Click Add

Reboot or re-login into your Ubuntu 18.04 system.

Go to: /etc/conky Open: conky.conf as admin
Simply, sudo nano /etc/conky/conky.conf
Change alignmentt = 'top_right'
Ctrl + O to save and Ctrl + X to exit

or another way to change it is:
sudo sed -i 's/left/right/' /etc/conky/conky.conf

This will change conky.conf for all users in ubuntu.
To make it specific for a user only do:
cp /etc/conky/conky.conf ~/.conkyrc

The above command created a user based Conky configuration file located at ~/.conkyrc.
To apply changes, re-login or reboot.

To make network monitor work, need to change eth0 with your network interface name:
rb@rbhost:~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 70:85:c2:a9:43:c3 brd ff:ff:ff:ff:ff:ff
rb@rbhost:~$  nmcli device status
DEVICE  TYPE      STATE      CONNECTION       
eno1    ethernet  connected  Wired connection 1
lo      loopback  unmanaged  --

So mine is: eno1

CPU details: lscpu
cat /sys/class/thermal/thermal_zone1/temp
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t

pch_cannonlake  40000
x86_pkg_temp    31000

https://askubuntu.com/questions/1110943/
Platform Controller Hub
Processor package temperature

https://nvidia.custhelp.com/app/answers/detail/a_id/3751/~/useful-nvidia-smi-queries
$ nvidia-smi --query-gpu=gpu_name --format=csv,noheader
GeForce RTX 2070
$ nvidia-smi --query-gpu=clocks.sm --format=csv,noheader
1410 MHz
$ nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader
38
$ nvidia-smi --query-gpu=driver_version --format=csv,noheader
410.104
$ nvidia-smi --query-gpu=pstate --format=csv,noheader
P8
$ nvidia-smi --query-gpu=vbios_version --format=csv,noheader
90.06.18.00.9E
$ nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader
18 %
$ nvidia-smi --query-gpu=utilization.memory --format=csv,noheader
5 %
$ nvidia-smi --query-gpu=power.draw --format=csv,noheader
35.69 W
$ nvidia-smi --query-gpu=clocks.mem --format=csv,noheader
405 MHz

When RAM is full Swap is used, to clear swap:
sudo swapoff -a && sudo swapon -a

So Finally:



-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo

Any original torsmo code is licensed under the BSD license

All code written since the fork of torsmo is licensed under the GPL

Please see COPYING for details

Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see .
]]

conky.config = {
    alignment = 'top_right',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
 default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    use_xft = true,
    font = 'DejaVu Sans Mono:size=9',
    gap_x = 10,
    gap_y = 37,
    minimum_height = 5,
 minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false,
    own_window_argb_visual = true,
    own_window_argb_value = 100,
    double_buffer = true
}

conky.text = [[
${color}Base: $sysname-$kernel $machine
$hr
${color}Intel(R) Core(TM) i5-9600K @ 3.70GHz
${color white}CPU Frequency:$color ${freq_g}GHz (${freq}MHz)
${color white}CPU1:$color ${cpu cpu1}% ${cpubar cpu1 10}
${color white}CPU2:$color ${cpu cpu2}% ${cpubar cpu1 10}
${color white}CPU3:$color ${cpu cpu3}% ${cpubar cpu1 10}
${color white}CPU4:$color ${cpu cpu4}% ${cpubar cpu1 10}
${color white}CPU5:$color ${cpu cpu5}% ${cpubar cpu1 10}
${color white}CPU6:$color ${cpu cpu6}% ${cpubar cpu1 10}
${color white}All CPUs:${color green} ${cpu}% ${color white}${alignr}Uptime:$color $uptime
${color white}PKG Temp: ${color green}${execpi .001 cat /sys/class/thermal/thermal_zone1/temp | cut -c1-2}°C${color white}${alignr}PCH Temp: ${color green}${execpi .001 cat /sys/class/thermal/thermal_zone0/temp | cut -c1-2}°C
${color white}$hr
${color white}RAM :${color green} $mem${color}/$memmax - $memperc% ${membar 10}
${color white}Swap:${color green} $swap${color}/$swapmax - $swapperc% ${swapbar 10}
${color white}Processes:$color $processes  ${color white}Running:$color $running_processes
$hr
${execpi .001 (nvidia-smi --query-gpu=gpu_name --format=csv,noheader)} @ ${execpi .001 (nvidia-smi --query-gpu=clocks.sm --format=csv,noheader)} ${alignr}Temp: ${color green}${execpi .001 (nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader)}°C$color
GPU Usage   : ${color green}${execpi .001 (nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader)}${color}${alignr} PCIe Link Gen: ${execpi .001 (nvidia-smi --query-gpu=pcie.link.gen.current --format=csv,noheader)}/${execpi .001 (nvidia-smi --query-gpu=pcie.link.gen.max --format=csv,noheader)}
Memory Usage: ${color green}${execpi .001 (nvidia-smi --query-gpu=utilization.memory --format=csv,noheader)} ${execpi .001 (nvidia-smi --query-gpu=memory.used --format=csv,noheader)}${color}/${execpi .001 (nvidia-smi --query-gpu=memory.total --format=csv,noheader)}
#P-State     : ${execpi .001 (nvidia-smi --query-gpu=pstate --format=csv,noheader)}
#Driver      : ${execpi .001 (nvidia-smi --query-gpu=driver_version --format=csv,noheader)} 
#BIOS        : ${execpi .001 (nvidia-smi --query-gpu=vbios_version --format=csv,noheader)}
#Total Memory: ${execpi .001 (nvidia-smi --query-gpu=memory.total --format=csv,noheader)}
#Memory Used : ${execpi .001 (nvidia-smi --query-gpu=memory.used --format=csv,noheader)} 
#Memory Free : ${execpi .001 (nvidia-smi --query-gpu=memory.free --format=csv,noheader)}
$hr
${color white}File systems: ${color green}${fs_used /}${color}/${fs_size /} ${fs_bar 10 /}
${color white}Network: Up:$color ${upspeed eno1}${color white} Down:$color ${downspeed eno1}
$hr
${color white}Name              PID    CPU%   MEM%
${color white}${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color white}${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color white}${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color white}${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color white}${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}
${color white}${top name 6} ${top pid 6} ${top cpu 6} ${top mem 6}
]]