On Wed, Feb 22, 2017 at 05:37:17PM +0000, Holger Levsen wrote:
> echo $(((`(for VM in $(xl list|egrep -v "(Name|dom0)"|cut -d " " -f1) ; do 
> /usr/lib/qubes/qrexec-client -d $VM user:"/usr/bin/vmstat -s -S K" -t -T|grep 
> "used memory"|cut -d "K" -f1 ; done)|xargs echo|sed "s# #+#g#"`)/1024))MB used
 
misses the used memory in dom0, so better:

echo $(((`(for VM in $(xl list|egrep -v "(Name|dom0)"|cut -d " " -f1) ; do 
/usr/lib/qubes/qrexec-client -d $VM user:"/usr/bin/vmstat -s -S K" -t -T|grep 
"used memory"|cut -d "K" -f1 ; done)|xargs echo $(vmstat -s -S K|grep "used 
memory"|cut -d "K" -f1)|sed "s# #+#g#"`)/1024))

which is better done like this:

echo $(((`( vmstat -s -S K ; for VM in $(xl list|egrep -v "(Name|dom0)"|cut -d 
" " -f1) ; do qvm-run $VM -p "/usr/bin/vmstat -s -S K" ; done ) | grep "used 
memory" | cut -d "K" -f1 | xargs echo | sed "s# #+#g#"`)/1024))

which is also easier to understand I think ;) Essentially it runs vmstat
everywhere and adds up the numbers for "used memory", that's all.

And, it still should better read /proc/meminfo…


-- 
cheers,
        Holger

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20170224120459.GA12227%40layer-acht.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Reply via email to