get perfomance date from cloudstack api

216 Views Asked by At

Please help me in getting date about perfomace hipervizor using simple api (in my case i used python).

There is simple example who gets list of machines :

#!/usr/bin/python

import CloudStack

api = 'http://example.com:8080/client/api'
apikey = 'API KEY'
secret = 'API SECRET'

cloudstack = CloudStack.Client(api, apikey, secret)

vms = cloudstack.listVirtualMachines()

for vm in vms:
    print "%s %s %s" % (vm['id'], vm['name'], vm['state'])

How from this script i can change it, to get for example CPU of all hipervizor machine? (if can give info not only about cpu, but about HDD utilization, memory, etc...)

Thanks, very much.

1

There are 1 best solutions below

0
On

You would get all the VM details along with all the CPU, Memory etc related data for a particular host. pass on the host id for getting the details for all VMs under that host.

I use response=json as param in the URL for getting back all these details in json format for easy parsing. Look at below URL for actual input and output params.

https://cloudstack.apache.org/docs/api/apidocs-4.5/root_admin/listVirtualMachines.html

hope it helps!!