VMware Cloud Community
techlearner123
Contributor
Contributor

VSAN cluster performance -vsan sdk

I am trying to view VSAN cluster performace using below code give in

Online Documentation - vSAN SDKs Programming Guide - VMware {code}

# Get vSAN cluster performance

def getClusterPerformance(cluster, vsanPerfSystem):

  spec = vim.cluster.VsanPerfQuerySpec()

  spec.entityRefId = "cluster-domclient:5287a00e-e90d-dbdc-1909-bf952fdaad3a"

  endTime = datetime.datetime.utcnow()

  startTime = endTime - datetime.timedelta(hours=1)

  spec.startTime = startTime

  spec.endTime = endTime

  result = vsanPerfSystem.VsanPerfQueryPerf(querySpecs=[spec], cluster=clusterMoID)

  return result

getting exceptions related to clusterMoID .

aceback (most recent call last):

  File "./get_vsan_cluster_performance.py", line 144, in <module>

    main()

  File "./get_vsan_cluster_performance.py", line 141, in main

    getClusterPerformance(cluster, vsanPerfSystem)

  File "./get_vsan_cluster_performance.py", line 75, in getClusterPerformance

    result = vsanPerfSystem.VsanPerfQueryPerf(querySpecs=[spec], cluster=clusterMoID)

NameError: name 'clusterMoID' is not defined

from where we are getting clusterMoID this data ?

0 Kudos
4 Replies
KabirAli82
Expert
Expert

Check this KB:

https://kb.vmware.com/s/article/1017126


Was I helpful? Give a kudo for appreciation!
Braindumping @ http://kablog.nl/
Tweeting @ https://twitter.com/_Kabir_Ali_
0 Kudos
KabirAli82
Expert
Expert

Wait that was not the best reply.

Best open up a https connection to your vcenter, select the cluster and check the URL. The part after "urn:vmomi:" is what you are looking for.

Here is mine:

pastedImage_1.png


Was I helpful? Give a kudo for appreciation!
Braindumping @ http://kablog.nl/
Tweeting @ https://twitter.com/_Kabir_Ali_
0 Kudos
someone007
Contributor
Contributor

hi,I also have a same problem what like yours.My problem is  how can I find "spec.entityRefId = "cluster-domclient:5287a00e-e90d-dbdc-1909-bf952fdaad3a" ,that is id?

thank you !

0 Kudos
someone007
Contributor
Contributor

HOW CAN I FIND entityRefId IS "cluster-domclient:5287a00e-e90d-dbdc-1909-bf952fdaad3a"?

THANK YOU

0 Kudos