VirtStat
VirtStat is my first program. Is an easy tool for KVM.Write in bash, VirtStat, allows you to extract info of your virtualization hosts like memory in use per guest, cpu and a host memory usage.
VirtStat also allows you to execute remote commands and copy directories and files to other virtualization hosts.
With VirtStat you can get the resume info printed on the screen or by mail.
The usage is easy:
$ VirStat [mail|screen|copy|exec]
mail) This function sends a mail with the lists of VM's in all virtualization hosts. USAGE: VirtStat mail
screen) Like mail but prints in screen the information. USAGE: VirStat screen
copy) Copy a file or directory in the same path on all other virtualization hosts. USAGE: VirtStat copy PATH DES-PATH
exec) Execute a command in head host and remote hosts. USAGE: VirtStat exec "command". EX: VirtStat exec "ls /home"
VirtStat uses two config files (/etc/VirtStat/):
-mail: in this file you configure the email addresses.
-servers: in this file you configure the virtualization hosts.
Why I'm writing this tool?
Well the lasts versions of Virt-manager don't give the memory usage by guests and my boss asks for it, so this was my solution.
In this example the outpout is unformatted (blog things :P):
============================================================================
==================== VIRTUAL MACHINE STATE 2014-03-25 ======================
============================================================================
---======= virtualXX =======---
Id Name State Memory %Use %CPU
-----------------------------------------------------------------------------------------
2 XY running 768 MB 4.07% 0.8%
3 VMxx running 512 MB 2.61% 5.0%
5 VMxX running 512 MB 2.61% 4.5%
9 XX running 1024 MB 3.78% 2.7%
12 VM01 running 1024 MB 5.21% 0.7%
13 VMXX running 1024 MB 5.15% 12.3%
16 VMx2 running 256 MB 1.36% 4.9%
17 VMx3 running 256 MB 1.36% 15.2%
18 VMx4 running 256 MB 1.36% 5.0%
20 VMxx running 4096 MB 17.91% 5.0%
21 VMxx running 1024 MB 2.34% 0.5%
28 VMxx running 512 MB 2.61% 6.7%
TOTAL ASSIGNED: 11264 MB
TOTAL % IN USE OF ASSIGNED MEMORY: 50.42%
------ MEMORIA virtualXX ------
total used free
Mem: 20119 16824 3295
Swap: 9535 9 9526
---======= virtualXX =======---
Id Name State Memory %Use %CPU
-----------------------------------------------------------------------------------------
1 VMxx running 1024 MB 2.82% 0.5%
2 VMxx running 512 MB 2.28% 3.6%
3 VMXX running 1024 MB 5.15% 9.8%
5 VMXX running 512 MB 1.82% 0.2%
6 VM02 running 1024 MB 3.04% 0.6%
TOTAL ASSIGNED: 4096 MB
TOTAL % IN USE OF ASSIGNED MEMORY: 15.13%
------ MEMORIA virtualXX ------
total used free
Mem: 20119 4636 15483
Swap: 9535 0 9535
---======= virtual-XX =======---
Id Name State Memory %Use %CPU
-----------------------------------------------------------------------------------------
1 VMxx running 1024 MB 13.05% 0.1%
4 VMxx running 1024 MB 3.82% 4.8%
TOTAL ASSIGNED: 2048 MB
TOTAL % IN USE OF ASSIGNED MEMORY: 16.96%
------ MEMORIA virtual-XX ------
total used free
Mem: 8003 2052 5951
Swap: 15344 0 15344
Subscribete
0 comments:
Post a Comment