I'm trying to get statistics of vsphere datastores.
While I'm able to get statistics of hosts, it fails with datastores:
from pysphere import VIServer
server = VIServer()
server.connect(HOST, USER, PASSWORD)
pm = server.get_performance_manager()
# querying hosts - works:
entities = server.get_hosts() # returns {entity: name}
counters = pm.get_entity_counters(entities.keys()[0]) # returns {name: id}
statistics = pm.get_entity_statistic(entities.keys()[0], counters.values()[:1])
# querying datastores - doesn't work:
entities = server.get_datastores() # returns {entity: name}
counters = pm.get_entity_counters(entities.keys()[0]) # returns {name: id}
statistics = pm.get_entity_statistic(entities.keys()[0], counters.values()[:1])
The last line raises the following error:
AttributeError Traceback (most recent call last)
<ipython-input-122-dbbb39ef8a75> in <module>()
----> 1 statistics = pm.get_entity_statistic(entities.keys()[0], counters.values()[:1])
.../python2.7/site-packages/pysphere/vi_performance_manager.pyc in get_entity_statistic(self, entity, counters, interval, composite)
183
184 instance_name = str(stat.Id.Instance)
--> 185 stat_value = str(stat.Value[0])
186 date_now = datetime.datetime.utcnow()
187 statistics.append(EntityStatistics(entity, stat.Id.CounterId, cname,
.../python2.7/site-packages/pysphere/ZSI/generate/pyclass.pyc in get(self)
146 if not callable(what):
147 def get(self):
--> 148 return getattr(self, what.aname)
149
150 if what.maxOccurs > 1:
AttributeError: 'DynamicData_Holder' object has no attribute '_value'
It seems the pysphere repository has been inactive for around 3 years now, and I couldn't find discussions mentioning this specific issue except for this: https://groups.google.com/forum/#!topic/pysphere/LQaF661msoQ
Unfortunately this solution doesn't cover the desired statistics but only simple stats of the current moment.
I also found a similar error reported, but it wasn't really addressed as far as I understand: https://github.com/itnihao/pysphere/issues/60
Any help would be greatly appreciated.