From 2f86db5cb7265a16ab5ab351e6613f71a645c189 Mon Sep 17 00:00:00 2001 From: Alexis Ben Miloud--Josselin Date: Fri, 1 Jun 2018 18:31:10 +0200 Subject: [PATCH] Add kvmstats.sh script --- kvmstats.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 kvmstats.sh diff --git a/kvmstats.sh b/kvmstats.sh new file mode 100644 index 0000000..5b3bc0f --- /dev/null +++ b/kvmstats.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +TMPFILE=$(tempfile) + +for VM in $(virsh list --all --name) +do + VCPU=$(hxselect -c 'domain vcpu' $TMPFILE + +( + echo vm vcpu ram disk + cat $TMPFILE + awk '{ vcpu += $2; ram += $3; disk += $4 } END { print "TOTAL", vcpu, ram, disk }' <$TMPFILE +) | column -t + +rm $TMPFILE