github.com/vmware/govmomi@v0.43.0/govc/test/metric_info_test.sh (about) 1 #!/bin/bash -e 2 3 types="Datacenter HostSystem ClusterComputeResource ResourcePool VirtualMachine Datastore VirtualApp" 4 5 for type in $types ; do 6 echo "$type..." 7 8 obj=$(govc ls -t "$type" ./... | head -n 1) 9 if [ -z "$obj" ] ; then 10 echo "...no instances found" 11 continue 12 fi 13 14 if ! govc metric.info "$obj" 2>/dev/null ; then 15 echo "...N/A" # Datacenter, Datastore on ESX for example 16 continue 17 fi 18 19 govc metric.ls "$obj" | xargs govc metric.sample -n 5 "$obj" 20 done