Skip to content

Commit

Permalink
Initial commit of perf.interval.info vPoller method
Browse files Browse the repository at this point in the history
* The perf.interval.info method is used for retrieving
  information about existing performance historical intervals
  • Loading branch information
dnaeon committed Jan 6, 2015
1 parent 80c8482 commit 0d35860
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/vpoller/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ def __init__(self, user, pwd, host):
'method': self.perf_counter_info,
'required': ['hostname'],
},
'perf.interval.info': {
'method': self.perf_interval_info,
'required': ['hostname'],
},
}

def _validate_client_msg(self, msg, required):
Expand Down Expand Up @@ -859,6 +863,38 @@ def perf_counter_info(self, msg):

return self._get_perf_counter_info(counter_id=counter_id)

def perf_interval_info(self, msg):
"""
Get information about existing performance historical intervals
Example client message would be:
{
"method": "perf.interval.info",
"hostname": "vc01.example.org",
}
Returns:
The existing performance historical interval on the system
"""
logging.info(
'[%s] Retrieving existing performance historical intervals',
self.host
)

historical_interval = self.si.content.perfManager.historicalInterval

data = [{k: getattr(interval, k) for k in ('enabled', 'key', 'length', 'level', 'name', 'samplingPeriod')} for interval in historical_interval]

result = {
'msg': 'Successfully retrieved performance historical intervals',
'success': 0,
'result': data
}

return result

def net_discover(self, msg):
"""
Discover all pyVmomi.vim.Network managed objects
Expand Down

0 comments on commit 0d35860

Please sign in to comment.