Conky

Conky is a lightweight system monitor, which works well with i3.

Basic setup

Install with

qubes-dom0-update conky

In dom0.

Add the following to your conkyrc (~/.conkyrc)

conky.config = {
  use_spacer = 'left',
  pad_percents = 3,
  background = false,
  font = 'DejaVu Sans Mono:size=10',
  use_xft = true,
  alignment = 'top_right',
  gap_x = 10,
  gap_y = 40,
  own_window_transparent = true,
  xinerama_head = 3,
--  own_window_argb_visual = true,
--  own_window_argb_value = 90,
  own_window = true,
  double_buffer = true,
  own_window_class = 'Conky',
--  own_window_type =  'desktop',
 own_window_type =  'override',
--  own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',
  own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager,below',
  own_window = true,
  update_interval = 5.0,
}

conky.text = [[
${hr}
${color orange}CPU:${color} ${freq_g} GHz ${exec sensors | grep Package | awk '{print $4}' | tr -d '+'}
${color orange}Xen CPU ${execbar awk '{SUM += $2} END {print SUM/8}' /dev/shm/xen_cpu }
${hr}
${exec cat /dev/shm/xen_cpu}
${hr}
${color orange}Xen memory usage ${execbar ~/.conky/xen_memory.sh }
${execgraph ~/.conky/xen_memory.sh }
${color orange}Qubes used ${exec xl list | tail -n +3 | grep -v ^sys- | wc -l}
${cpugraph}
${hr}
${color orange}Dom0 RAM:  ${color}${mem}/${memmax}
${memperc}% ${membar 4}
${memgraph}
${color orange}Dom0 load average: ${color}${loadavg}
${hr}
${color orange}Disk IOPS
${diskiograph /dev/md127}
Disk usage: ${execbar sudo lvs | grep -E '^ +pool00' | awk '{print $5}'}
${color orange}Dom0 root ${color}${fs_used /}/${fs_size /} ${fs_bar 6 /}
${hr}
${color orange}${exec ~/.conky/qubes_ip_conky.sh}
]]

Add the following lines to your i3 config (found in here), to start conky.

#Start conky
#You don't need this if you include it in your screen config.
exec --no-startup-id "conky -d"

#Start the xen cpu monitor
exec --no-startup-id "~/.conky/xen_cpu.sh &"

xen_cpu.sh should be in ~/.conky/xen_cpu.sh

   1 #!/bin/bash
   2 xentop -f -b  -d 1 | sed -u -e s/NAME.*//g | grep --line-buffered -v Domain-0 | awk '{print $1, $4; fflush()}' | while read lne; do
   3         if [ "$lne" == "" ]; then
   4                 if [ -s /dev/shm/xen_cpu_cur ]; then
   5                         sort -n -k 2 -r /dev/shm/xen_cpu_cur | tail -n 5 > /dev/shm/xen_cpu_sorted
   6                         mv -f /dev/shm/xen_cpu_sorted /dev/shm/xen_cpu
   7                 fi
   8                 echo -n '' > /dev/shm/xen_cpu_cur
   9         else
  10                 echo $lne >> /dev/shm/xen_cpu_cur
  11         fi
  12 done

xen_memory.sh should be in ~/.conky/xen_memory.sh

   1 #!/bin/bash
   2 xentop -b -i 1 | tail -n +2 | awk '{sum += $6} END {print sum}'

qubes_ip_conky.sh should be in ~/.conky/xqubes_ip_conky.sh

   1 #!/bin/bash
   2 DOMID=`xl list | grep sys-net | awk '{print $2}' | head -n 1`
   3 nets="" #Your interfaces here, space sep
   4 for i in $nets; do
   5         IP=`xenstore-read /local/domain/$DOMID/backend/$i/ip 2>/dev/null`
   6         UP=`xenstore-read /local/domain/$DOMID/backend/$i/up 2>/dev/null`
   7         TX=`xenstore-read /local/domain/$DOMID/backend/$i/tx 2>/dev/null`
   8         RX=`xenstore-read /local/domain/$DOMID/backend/$i/rx 2>/dev/null`
   9         if [ "$UP" == "1" ]; then
  10                 echo "$i is up at $IP"
  11                 echo "$i $((TX / 1073741824))GB tx, $((RX / 1073741824))GB rx"
  12         else
  13                 echo "$i is down"
  14         fi
  15 done

And then in your sys-net, create a file conky.sh in /rw/config

   1 #!/bin/bash
   2 DOMID=`xl list | grep sys-net | awk '{print $2}' | head -n 1`
   3 nets="ens5 wls6"
   4 for i in $nets; do
   5         IP=`xenstore-read /local/domain/$DOMID/backend/$i/ip 2>/dev/null`
   6         UP=`xenstore-read /local/domain/$DOMID/backend/$i/up 2>/dev/null`
   7         TX=`xenstore-read /local/domain/$DOMID/backend/$i/tx 2>/dev/null`
   8         RX=`xenstore-read /local/domain/$DOMID/backend/$i/rx 2>/dev/null`
   9         if [ "$UP" == "1" ]; then
  10                 echo "$i is up at $IP"
  11                 echo "$i $((TX / 1073741824))GB tx, $((RX / 1073741824))GB rx"
  12         else
  13                 echo "$i is down"
  14         fi
  15 done

Add this line to /rw/rc.local

   1 /rw/config/conky.sh &

and set rc.local +x

   1 chmod +x /rw/config/rc.local
   2 chmod +x /rw/config/conky.sh

HowTo/Conky (last edited 2018-12-01 16:31:56 by admin)