Setting up Conky on Ubuntu 16.04LTS for the Clevo P751DM2-G
System Information:
We extract this with inxi:
installation:
sudo apt-get install inxi
Running it:
inxi -F
Output from my system:
System: Host: phantom Kernel: 4.13.0-32-generic x86_64 (64 bit)
Desktop: Gnome 3.18.5 Distro: Ubuntu 16.04 xenial
Machine: System: CLEVO (portable) product: P7xxDM2-(G)
Mobo: CLEVO model: P7xxDM2 powered by premamod.com v: BATMAN
Bios: Prema Mod v: 1.06.09PM v2.3 date: 01/11/2018
CPU: Quad core Intel Core i7-7700K (-HT-MCP-) cache: 8192 KB
clock speeds: max: 4500 MHz 1: 4200 MHz 2: 4200 MHz 3: 4200 MHz
4: 4200 MHz 5: 4200 MHz 6: 4200 MHz 7: 4200 MHz 8: 4200 MHz
Graphics: Card: NVIDIA Device 1be1
Display Server: X.Org 1.19.5 drivers: nvidia (unloaded: fbdev,vesa,nouveau)
Resolution: [email protected]
GLX Renderer: GeForce GTX 1070/PCIe/SSE2
GLX Version: 4.6.0 NVIDIA 390.25
Audio: Card-1 NVIDIA Device 10f0 driver: snd_hda_intel
Card-2 Intel Sunrise Point-H HD Audio driver: snd_hda_intel
Card-3 Texas Instruments driver: USB Audio
Sound: Advanced Linux Sound Architecture v: k4.13.0-32-generic
Network: Card-1: Intel I210 Gigabit Network Connection driver: igb
IF: enp60s0 state: down mac: 70:88:6b:80:da:2e
Card-2: Qualcomm Atheros Killer E2400 Gigabit Ethernet Controller
driver: alx
IF: enp109s0 state: down mac: 80:fa:5b:3e:bf:9e
Card-3: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter
driver: ath10k_pci
IF: wlp112s0 state: down mac: 9c:b6:d0:1a:81:27
Card-4: Atheros
IF: null-if-id state: N/A speed: N/A duplex: N/A mac: N/A
Drives: HDD Total Size: 9551.9GB (42.5% used)
ID-1: /dev/nvme0n1 model: N/A size: 1000.2GB
ID-2: /dev/sda model: Crucial_CT2050MX size: 2050.4GB
ID-3: /dev/sdb model: ST2000LM003_HN size: 2000.4GB
ID-4: /dev/sdc model: HGST_HTS541515A9 size: 1500.3GB
ID-5: /dev/sdd model: TOSHIBA_MQ01ABD1 size: 1000.2GB
ID-6: /dev/sde model: HGST_HTS541010A9 size: 1000.2GB
ID-7: /dev/sdf model: ST2000LM003_HN size: 2000.4GB
Partition: ID-1: / size: 385G used: 98G (27%) fs: ext4 dev: /dev/nvme0n1p6
ID-2: swap-1 size: 4.00GB used: 0.00GB (0%) fs: swap dev: /dev/nvme0n1p7
RAID: No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors: System Temperatures: cpu: 55.0C mobo: N/A gpu: 57C
Fan Speeds (in rpm): cpu: N/A
Info: Processes: 326 Uptime: 2:59 Memory: 4650.0/64311.0MB
Client: Shell (bash) inxi: 2.2.35
Using that information, we can now construct a usable conky configuration file. To get started, install Conky first from the repositories:
apt install conky
For the configuration, we will use the user-specified conky configuration file located at ~/.config/conky/conky.conf
.
Goals for the setup:
At the bare minimum, I'll need information on:
- System's hostname and the kernel version.
- Top processes.
- Processor name, per-core frequency and utilization.
- Hard drive temperature monitoring.
- GPU name, and utilization metrics (VRAM and core).
- Network processes, including inbound and outbound connections.
With that in mind, here comes the config, still a work in progress. Modify as needed:
less ~/.config/conky/conky.conf | xclip -sel clip
Contents:
alignment top_right
background = true
border_width 1
color1 07CC0D
color2 D1E7D1
color3 FF0000
color4 FFFFFF
cpu_avg_samples 2
default_color D1E7D1
default_outline_color white
default_shade_color white
double_buffer yes
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
#gap_x 20
#gap_y 20
border_outer_margin 20
max_port_monitor_connections 64
maximum_width 500
minimum_width 500
# max_specials 512
max_user_text 16384
minimum_size 330 10
net_avg_samples 2
no_buffers yes
out_to_console no
# wm_class_name Conky
stippled_borders 2
# wn_window yes
#settings to define how to draw the window. compiz needs these settings, adjust for your WM
own_window true
own_window_class Conky
#own_window_type override
#own_window_class conky-semi
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_value 50
update_interval 2
uppercase no
use_xft yes
xftalpha 0.8
xftfont Bitstream Vera Sans Mono:size=9
# WIDTH = 500pixel, ${goto 270} for 2 column designs
# SMALL BAR HEIGHT: 12, LARGE GRAPH HEIGHT: 240
TEXT
${color1}$nodename ${alignr}$kernel
${color1}Uptime:${color} $uptime ${color1} ${alignr}Load:${color} $loadavg
$hr
${alignr}${color1}RAM: $memperc% = $mem / $memmax
${color #88cc00}${cpugraph 60,240 07CC0D FF0000 -t} ${goto 270}${color #88cc00}${memgraph 60,250 07CC0D FF0000 -t}
${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 1-26}
${font sans-serif:bold:size=8}PROCESSOR UTILIZATION & FREQUENCY ${hr 2}${font}
CPU1: ${cpu cpu1}% $alignr ${freq (1)} MHz $alignr ${cpubar cpu1 8,60}
CPU2: ${cpu cpu2}% $alignr ${freq (2)} MHz $alignr ${cpubar cpu2 8,60}
CPU3: ${cpu cpu3}% $alignr ${freq (3)} MHz $alignr ${cpubar cpu3 8,60}
CPU4: ${cpu cpu4}% $alignr ${freq (4)} MHz $alignr ${cpubar cpu4 8,60}
CPU5: ${cpu cpu5}% $alignr ${freq (5)} MHz $alignr ${cpubar cpu5 8,60}
CPU6: ${cpu cpu6}% $alignr ${freq (6)} MHz $alignr ${cpubar cpu6 8,60}
CPU7: ${cpu cpu7}% $alignr ${freq (7)} MHz $alignr ${cpubar cpu7 8,60}
CPU8: ${cpu cpu8}% $alignr ${freq (8)} MHz $alignr ${cpubar cpu8 8,60}
${color #88cc00}Swap Usage: $swapperc% = $swap/$swapmax ${color #88cc00} ${swapbar 4 color1 color3}
$hr
${color1}Net Down:${color} ${downspeed wlp113s0} ${goto 270}${color1}Net Up:${color} ${upspeed wlp113s0}
${color1}${downspeedgraph wlp113s0 60,240 07CC0D FF0000 -t}${color1} ${goto 270}${upspeedgraph wlp113s0 60,250 07CC0D FF0000 -t}
$hr
${color1}Temperatures in Celsius:
${color1}HDDs ${color} ${hddtemp /dev/sda} ${hddtemp /dev/sdb}
${color1}CPUs ${color} ${hwmon 0 temp 1}
${color1}PCH ${color} ${hwmon 1 temp 1}
#GPU Attributes:
${color1}GPU:${color #FCAF3E}${exec nvidia-smi --query-gpu=gpu_name --format=csv,noheader,nounits} $color
${color1}GPU Temperature ${color} ${execi 60 nvidia-settings -query [gpu:0]/GPUCoreTemp -t} °C
${color1}GPU Utilization ${color} ${exec nvidia-smi | grep % | cut -c 61-63} %
${color1}VRAM Utilization ${color} ${exec nvidia-smi | grep % | cut -c 37-40} MB
${color1}GPU Power Draw ${color} ${exec nvidia-smi | grep % | cut -c 21-23} W
${color1}Top Processes:
${color1}Name PID CPU% MEM% TIME USER
${color}${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} ${top time 1} ${top user 1}
${color}${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} ${top time 2} ${top user 2}
${color}${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} ${top time 3} ${top user 3}
${color}${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4} ${top time 4} ${top user 4}
${color}${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5} ${top time 5} ${top user 5}
$hr
#${color Tan2}ESTABLISHED Connections${color DarkSlateGray}${hr 2}
#
#${offset 10}${color lightgrey}Inbound: ${color white}${tcp_portmon 1 32767 count} ${color lightgrey}Outbound: ${color white}${tcp_portmon 32768 61000 count}${alignr}${color lightgrey}Total: ${color white}${tcp_portmon 1 65535 count}
#
#${color slate grey}Process ${color slate grey}Remote Host ${color slate grey}L-Port ${alignr}${color slate grey}R-Port${color lightgrey}
#
#${texeci 3 netstat -ap | grep 'ESTABLISHED' | sed -r 's|.*[0-9.]+:([0-9]*)\s*([^:]+):([a-zA-Z]+)[^/]+/([a-zA-Z0-9]*)|\4 \2 \1 \3|' | awk '{printf("%-14s %-20s %5s %7s\n",$1,$2,$3,$4)}'}
#old way for network
${color1} Port(s) ${alignr} #Connections
${color} Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768 61000 count} ${alignr} ALL: ${tcp_portmon 1 65535 count}
${color1} Inbound Connection ${alignr} Local Service/Port ${color}
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${tcp_portmon 1 32767 rhost 3} ${alignr} ${tcp_portmon 1 32767 lservice 3}
${tcp_portmon 1 32767 rhost 4} ${alignr} ${tcp_portmon 1 32767 lservice 4}
${color1}Outbound Connection ${alignr} Remote Service/Port${color}
${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
Notes:
For hard drive temperature, ensure that hddtemp is running as a daemon. You can do that by editing /etc/default/hddtemp
and ensuring that RUN_DAEMON
is set to TRUE
. When done, restart the hddtemp unit service by:
sudo systemctl restart hddtemp.service
For the NVIDIA GPU monitoring, ensure that persistence mode is enabled. This is the default for desktop systems on Ubuntu 16.04LTS. For server systems, you may need to do this manually.
Tweak the config to suit your needs.
WIP
I'll need to add support for power measurements via powerstat.
@Brainiarc7 Thanks, never heard of conky until today, so this was super handy.
@Supporterino
This worked for me.
nvidia-smi
has the -i arg to target a specific GPU. I just replaced eachnvidia-smi
withnvidia-smi -i 0
ornvidia-smi -i 1
.