This is the simple edition - I have a further one that takes data about the KVM from the local node by ps and alike, i will probably post it in some days/week.
This script simply SSHs into all nodes from a downloaded hostsfile (or a single host by IP/hostname), executes a local script that dumps the KVMs as variables back to the source server and then displays it.
If you want to use a local file you can simply modify the curl part.
Hostsfile format is simply "hostname,IP".
For informations it requires a secondary script (vminfo) installed on all nodes.
vminfo is very useful for own scripts as well, in special due to the VARDUMP option.
It should work on any KVM setup unless the ISO mount is before the HDD mount in the Libvirt XML (will display ISO size/path then).
Example output (vmlist):
root@computing01:~# vmlist
Host: computing01 IP: 10.76.138.10
VM: icinga CPUs: 1 RAM: 1024 MB VNC: 10.76.138.22:5902 HDD: /dev/zvol/ssd01/zvol_icinga / 10.7 GB
VM: ircd CPUs: 1 RAM: 512 MB VNC: 10.76.138.22:5903 HDD: /dev/zvol/ssd01/zvol_ircd / 10.7 GB
VM: jabber CPUs: 1 RAM: 512 MB VNC: 10.76.138.22:5904 HDD: /dev/zvol/ssd01/zvol_jabber / 10.7 GB
VM: mailserver CPUs: 2 RAM: 2024 MB VNC: 10.76.138.22:5905 HDD: /dev/zvol/ssd01/zvol_mailserver / 32.2 GB
VM: revproxy CPUs: 1 RAM: 512 MB VNC: 10.76.138.22:5909 HDD: /dev/zvol/ssd01/zvol_revproxy / 10.7 GB
VM: hosting CPUs: 2 RAM: 4096 MB VNC: 10.76.138.22:5916 HDD: /dev/zvol/ssd01/zvol_hosting / 53.7 GB
VM: monitoring CPUs: 4 RAM: 4096 MB VNC: 10.76.138.22:5927 HDD: /dev/zvol/ssd01/zvol_monitoring / 85.9 GB
Host: storage01 IP: 10.76.138.2
VM: ftpshare CPUs: 1 RAM: 512 MB VNC: 10.76.138.20:5915 HDD: /dev/zvol/storage01/kvm/zvol_ftpshare / 10.7 GB
VM: gestioip CPUs: 1 RAM: 1024 MB VNC: 10.76.138.20:5901 HDD: /dev/zvol/storage01/kvm/zvol_gestioip / 10.7 GB
VM: proxy CPUs: 1 RAM: 512 MB VNC: 10.76.138.20:5908 HDD: /dev/zvol/storage01/kvm/zvol_proxy / 10.7 GB
VM: vpn CPUs: 2 RAM: 2048 MB VNC: 10.76.138.20:5919 HDD: /dev/zvol/storage01/kvm/zvol_vpnvie / 10.7 GB
VM: zeyuu CPUs: 1 RAM: 1024 MB VNC: 10.76.138.20:5925 HDD: /dev/zvol/storage01/kvm/zvol_zeyuu / 107.4 GB
Host: storage02 IP: 10.76.138.3
VM: n2nvie CPUs: 2 RAM: 1024 MB VNC: 10.76.138.21:5921 HDD: /dev/zvol/storage02/kvm/zvol_n2nvie / 10.7 GB
Host: computing02 IP: 10.76.138.55
VM: win2012 CPUs: 4 RAM: 1536 MB VNC: 10.76.138.23:5913 HDD: /dev/raid10-vol/win2012 / 96.6 GB
Example outputs (vminfo):
root@computing02:~# vminfo win2012 VARDUMP
VMNAME=win2012 VMVNCIP=10.76.138.23 VMVNCP=5913 VMCPUS=4 VMRAM=1536 VMDISK=/dev/raid10-vol/win2012 VMDISKS=96.6
root@computing02:~# vminfo win2012
Local KVM win2012
VNC IP: 10.76.138.23 Port: 5913 Combined: 10.76.138.23:5913
4 CPU cores - 1536 MB RAM
Boot disk /dev/raid10-vol/win2012 - Size: 96.6
Download vmlist:
wget --no-check-certificate https://william.si/code/vmlist
Download vminfo:
This script simply SSHs into all nodes from a downloaded hostsfile (or a single host by IP/hostname), executes a local script that dumps the KVMs as variables back to the source server and then displays it.
If you want to use a local file you can simply modify the curl part.
Hostsfile format is simply "hostname,IP".
For informations it requires a secondary script (vminfo) installed on all nodes.
vminfo is very useful for own scripts as well, in special due to the VARDUMP option.
It should work on any KVM setup unless the ISO mount is before the HDD mount in the Libvirt XML (will display ISO size/path then).
Example output (vmlist):
root@computing01:~# vmlist
Host: computing01 IP: 10.76.138.10
VM: icinga CPUs: 1 RAM: 1024 MB VNC: 10.76.138.22:5902 HDD: /dev/zvol/ssd01/zvol_icinga / 10.7 GB
VM: ircd CPUs: 1 RAM: 512 MB VNC: 10.76.138.22:5903 HDD: /dev/zvol/ssd01/zvol_ircd / 10.7 GB
VM: jabber CPUs: 1 RAM: 512 MB VNC: 10.76.138.22:5904 HDD: /dev/zvol/ssd01/zvol_jabber / 10.7 GB
VM: mailserver CPUs: 2 RAM: 2024 MB VNC: 10.76.138.22:5905 HDD: /dev/zvol/ssd01/zvol_mailserver / 32.2 GB
VM: revproxy CPUs: 1 RAM: 512 MB VNC: 10.76.138.22:5909 HDD: /dev/zvol/ssd01/zvol_revproxy / 10.7 GB
VM: hosting CPUs: 2 RAM: 4096 MB VNC: 10.76.138.22:5916 HDD: /dev/zvol/ssd01/zvol_hosting / 53.7 GB
VM: monitoring CPUs: 4 RAM: 4096 MB VNC: 10.76.138.22:5927 HDD: /dev/zvol/ssd01/zvol_monitoring / 85.9 GB
Host: storage01 IP: 10.76.138.2
VM: ftpshare CPUs: 1 RAM: 512 MB VNC: 10.76.138.20:5915 HDD: /dev/zvol/storage01/kvm/zvol_ftpshare / 10.7 GB
VM: gestioip CPUs: 1 RAM: 1024 MB VNC: 10.76.138.20:5901 HDD: /dev/zvol/storage01/kvm/zvol_gestioip / 10.7 GB
VM: proxy CPUs: 1 RAM: 512 MB VNC: 10.76.138.20:5908 HDD: /dev/zvol/storage01/kvm/zvol_proxy / 10.7 GB
VM: vpn CPUs: 2 RAM: 2048 MB VNC: 10.76.138.20:5919 HDD: /dev/zvol/storage01/kvm/zvol_vpnvie / 10.7 GB
VM: zeyuu CPUs: 1 RAM: 1024 MB VNC: 10.76.138.20:5925 HDD: /dev/zvol/storage01/kvm/zvol_zeyuu / 107.4 GB
Host: storage02 IP: 10.76.138.3
VM: n2nvie CPUs: 2 RAM: 1024 MB VNC: 10.76.138.21:5921 HDD: /dev/zvol/storage02/kvm/zvol_n2nvie / 10.7 GB
Host: computing02 IP: 10.76.138.55
VM: win2012 CPUs: 4 RAM: 1536 MB VNC: 10.76.138.23:5913 HDD: /dev/raid10-vol/win2012 / 96.6 GB
Example outputs (vminfo):
root@computing02:~# vminfo win2012 VARDUMP
VMNAME=win2012 VMVNCIP=10.76.138.23 VMVNCP=5913 VMCPUS=4 VMRAM=1536 VMDISK=/dev/raid10-vol/win2012 VMDISKS=96.6
root@computing02:~# vminfo win2012
Local KVM win2012
VNC IP: 10.76.138.23 Port: 5913 Combined: 10.76.138.23:5913
4 CPU cores - 1536 MB RAM
Boot disk /dev/raid10-vol/win2012 - Size: 96.6
Download vmlist:
wget --no-check-certificate https://william.si/code/vmlist
Download vminfo:
Code:
wget --no-check-certificate https://william.si/code/vminfo