Only count running VM in total

This commit also fixes the way kvmstats counts
running VM.
This commit is contained in:
Alexis Ben Miloud--Josselin 2018-08-02 17:37:55 +02:00
parent 4b5c68ca57
commit cfa1cf2261
1 changed files with 1 additions and 1 deletions

View File

@ -82,7 +82,7 @@ done >"$TMPFILE"
(
echo vm vcpu ram disk running
cat "$TMPFILE"
awk '{ vcpu += $2; ram += $3; disk += $4; running += length($5) } END { print "TOTAL", vcpu, ram, disk, running }' <"$TMPFILE"
awk '/yes$/ { vcpu += $2; ram += $3; disk += $4; running++ } END { print "TOTAL(running)", vcpu, ram, disk, running }' <"$TMPFILE"
if [ $SHOW_AVAIL ]
then
AV_CPU=$(awk '/^processor/ { cpu++ } END { print cpu }' /proc/cpuinfo)