Skip to content

Commit

Permalink
Implement cluster.perf.counter.info vPoller method
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Jan 6, 2015
1 parent ecb3b7e commit 3f08622
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/vpoller/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,40 @@ def cluster_discover(self, msg):

return r

def cluster_perf_counter_info(self, msg):
"""
Get performance counters available for a vim.ClusterComputeResource object
Example client message would be:
{
"method": "cluster.perf.counter.info",
"hostname": "vc01.example.org",
"name": "MyCluster"
}
Returns:
Information about the supported performance counters for the object
"""
obj = self.get_object_by_property(
property_name='name',
property_value=msg['name'],
obj_type=pyVmomi.vim.ClusterComputeResource
)

try:
metric_id = self.si.content.perfManager.QueryAvailablePerfMetric(entity=obj)
except pyVmomi.vim.InvalidArgument as e:
return {
'success': 1,
'msg': 'Cannot retrieve performance counters for %s: %s' % (msg['name'], e)
}

counter_id = [m.counterId for m in metric_id]

return self._get_perf_counter_info(counter_id=counter_id)

def cluster_get(self, msg):
"""
Get properties of a vim.ClusterComputeResource managed object
Expand Down Expand Up @@ -2505,7 +2539,7 @@ def datastore_perf_counter_info(self, msg):
{
"method": "datastore.perf.counter.info",
"hostname": "vc01.example.org",
"name": ""ds:///vmfs/volumes/643f118a-a970df28/",
"name": "ds:///vmfs/volumes/643f118a-a970df28/",
}
Returns:
Expand Down

0 comments on commit 3f08622

Please sign in to comment.