我正在尝试获取vsphere数据存储区的统计信息。
虽然我能够获取主机的统计信息,但是数据存储失败了:
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])
最后一行引发以下错误:
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'
似乎pysphere存储库已经处于非活动状态大约3年了,除了这个之外我找不到提及此特定问题的讨论: https://groups.google.com/forum/#!topic/pysphere/LQaF661msoQ
不幸的是,这个解决方案并不涵盖所需的统计数据,而只包含当前时刻的简单统计数据。
我也发现了一个类似的错误报告,但据我所知,它并没有真正解决: https://github.com/itnihao/pysphere/issues/60
非常感谢任何帮助。