From a002fca75b45f193a600297d9f711e781acffc98 Mon Sep 17 00:00:00 2001 From: "[799]" Date: Sun, 24 Jun 2018 15:49:41 +0200 Subject: [PATCH] Create system-stats-xen A ressource monitor which can be run in dom0 and uses low system ressources --- code/monitoring/system-stats-xen | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 code/monitoring/system-stats-xen diff --git a/code/monitoring/system-stats-xen b/code/monitoring/system-stats-xen new file mode 100644 index 0000000..2657443 --- /dev/null +++ b/code/monitoring/system-stats-xen @@ -0,0 +1,27 @@ +#!/bin/sh +# Author: tasket +# Github: https://github.com/tasket/ +# Usage : A ressource monitor which can be run in dom0 and uses low system ressources (compared to Qubes Manager) +# +# Link to the repository of the initial author (tasket): +# https://github.com/tasket/Qubes-scripts/blob/master/system-stats-xen + +delay=5 +sensor_lines='Package id 0|fan1' + +lnparse () { + if [ "$2" = 'CPU(%)' ]; then + clear + sensors |grep -E "^($sensor_lines)" + echo -e "\nVM NAME CPU(% ) MEMORY(MB)" + else + echo "$ln" + fi +} + +clear +stdbuf -oL xentop -b -f -d $delay \ +| stdbuf -oL awk '{sub(/\.[0-9]/, " ")} {printf ("%-20s %5s %7\047d\n", $1,$4,$5/1000) }' \ +| while read ln; do + lnparse $ln + done