Jump to content
Updated Privacy Statement
  • 0

List all VM info in a csv


SCOTT FARWELL

Question

I'd like to list all of the VM params I specify (or all params) in a 1 line per VM CSV output I can then put into excel. (don't care what delimiter is used)

 

At a minimum I want to use "name-label, power-state, memory-static-max, VCPUs-max, os-version, disks, networks" but I need to output this info for 385 VMs so I am looking for a way to grab this information without trying to build my own parser using awk/perl/python. (I have limited experience with each)

 

Maybe someone has already done this and would be willing to share their parser.

 

"xe vm-list is-control-domain=false params=name-label,power-state,memory-static-max,VCPUs-max,os-version,disks,networks" gives me that base info I need but it is output on 7 lines per VM separated by a blank line like this:

 

name-label ( RW)           : krtb7
          power-state ( RO): running
    memory-static-max ( RW): 3221225472
            VCPUs-max ( RW): 2
           os-version (MRO): name: CentOS Linux release 7.2.1511 (Core); uname: 3.10.0-327.el7.x86_64; distro: centos; major: 7; minor: 2
                disks (MRO):
             networks (MRO): 0/ip: 10.10.40.63

I would like to have something more like :

"name-label ( RW):krtb7,power-state ( RO):running,memory-static-max ( RW):3221225472,VCPUs-max ( RW):2, os-version (MRO): CentOS Linux release 7.2.1511, disks (MRO):,networks (MRO):0/ip: 10.10.40.63"

or 

"krtb7,running,3221225472,2, CentOS Linux release 7.2.1511,,10.10.40.63"

Unfortunately --minimal appears to be the only output modifier I have found and that takes it down to just the VM name.

 

I am basically wanting a full inventory of my VMs and resource usage.  Not sure how to get disk space allocated/used either.

Link to comment

4 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...