dnaeon / py-vpoller

Distributed vSphere API Proxy
Other
83 stars 31 forks source link

[question] Cluster usage summary #276

Closed k05054 closed 3 years ago

k05054 commented 3 years ago

Hi ! I've encountered with an interestig problem and need help to solve it out. I'm trying to make template for a cluster that shows all info about cluster resources and usage stats. I tried to poll cluster summary with the request: vpoller-client --method cluster.get --vsphere-host vcenter.test.local --name test-cluster --properties summary and got the answer {"msg": "Successfully retrieved object properties", "result": [{"name": "test-cluster", "summary": {"numCpuThreads": 144, "numVmotions": 141, "numHosts": 2, "dasData": {"dynamicType": null, "hostListVersion": 49, "dynamicProperty": [], "clusterConfigVersion": 37, "compatListVersion": 154}, "drsScore": null, "usageSummary": {"poweredOffVmCount": 3, "memReservationMB": 18284, "memDemandMB": 47625, "poweredOffMemReservationMB": 0, "dynamicType": null, "totalMemCapacityMB": 1017234, "dynamicProperty": [], "memEntitledMB": 87118, "cpuEntitledMhz": 38202, "poweredOffCpuReservationMhz": 0, "totalVmCount": 21, "statsGenNumber": 226024, "cpuReservationMhz": 0, "totalCpuCapacityMhz": 149312, "cpuDemandMhz": 36034}, "currentBalance": 62, "dynamicType": null, "totalCpu": 165240, "dynamicProperty": [], "totalMemory": 1098667360256, "effectiveMemory": 1017234, "targetBalance": 200, "numCpuCores": 72, "effectiveCpu": 149312, "currentEVCModeKey": null, "admissionControlInfo": {"dynamicType": null, "dynamicProperty": [], "currentCpuFailoverResourcesPercent": 99, "currentMemoryFailoverResourcesPercent": 98}, "currentFailoverLevel": 1, "overallStatus": "green", "numVmsPerDrsScoreBucket": [], "numEffectiveHosts": 2}}], "success": 0} So as far as i understand if i want to poll "cpuEntitledMhz" i need to make request vpoller-client --method cluster.get --vsphere-host vcenter.test.local --name test-cluster --properties summary.usageSummary.cpuEntitledMhz But it doesn't work and --properties summary.cpuEntitledMhz doesn't work either. I'm kinda confused and need help. How can i get metrics from "usageSummary" ? Is it even possible ?

rapgro commented 3 years ago

Obviously this is about pyvmomi internals. What version do you use?

k05054 commented 3 years ago

I'm using pyvmomi version 7.0 for python 2.7.

k05054 commented 3 years ago

Hi ! Today i've encountered with similar problem with datastore accessibility on the nodes. I tried to make some digging about why it's happening and how to insert needed data to zabbix.
First of all @rapgro was totally right and we can't dig deeper because of pyvmomi. And as far as i understand the JSON above won't be serialized by helper because there is more than one JSON array. Second problem is that we can't skip the helpers step if we are using native vpoller support. This problem can be solved with usage of userparameters or systemrun in zabbix. So i'll try to parse all this json to get data i need. Thanks for help !