How Much Detail Can You Get About a Virtual Machine (VM) from your Storage?
Thanks to Jerome over at http://nutanix.blogspot.com/2013/08/how-much-of-detail-can-you-get-about-vm.html for the below post! Most storage vendors say that they are VM aware, but it is difficult for the centralized storage vendors to identify VMs, even getting host level statistics is pain, because you need map a LUN to WWNN/iSCSI initiator and then WWNN/iSCSI initiator to a host. With Nutanix, it is a breeze, because it is a converged platform and Nutanix is VM aware. In addition to statistics, Nutanix localizes data based on where the VM is accessing data from. This is quick overview, in no way it is complete in what other stats we can get. From Nutanix CLI (NCLI): ncli vm list — list of VMs running, it gives CPU ,memory, vdisks configured. ncli vdisk ls vm-name=“name of the VM” ncli vm ls-stats name=“name of the VM” Example: Snippet of ncli vm ls ID : 50160a6e-d5c2-041d-7a2d-541530f8c86b Name : nfs-ubu-stress-Colossus09-1-4 VM IP Addresses : Hypervisor Host ID : 3 Hypervisor Host Name : 10.3.177.183 Memory (MB) : 4096 Virtual CPUs : 2 VDisk Count : 1 VDisks : NFS:19812 ncli vm ls-stats name=nfs-ubu-stress-Colossus09-1-20 Name: nfs-ubu-stress-Colossus09-1-20 VM IP Addresses : 10.3.58.235 Hypervisor Host ID : 746301033 Memory (MB) : 4096 Virtual CPUs : 2 Disk Bandwidth (Kbps) : 25230 Network Bandwidth (Kbps) : 0 Latency (micro secs) : 2215 CPU Usage Percent : 100% Memory Usage : 1.02 GB (1,090,516,000 bytes) GUI:
From REST API: nutanix@NTNX-450-A-CVM:10.1.59.66:~$ cat test_resp.py #!/usr/bin/python import json as json import requests def main(): base_url = “https://colossus09-c1.corp.nutanix.com:9440/PrismGateway/services/rest/v1/” s = requests.Session() s.auth = (‘admin’, ‘admin’) s.headers.update({‘Content-Type’: ‘application/json; charset=utf-8’}) print s.get(base_url + ‘vms/
50169534-35e1-a1de-c23e-1d1135151293’, verify=False).json() #just VMs will get the all VMs and then you actively get specific vm if __name__ == “__main__”: main() run test_resp.py Output for one VM:
{
"vmId": "