通过这篇文章的介绍:
http://tutorials.github.io/pages/retrieving-storm-data-from-nimbus.html#.UdPrdJyZvFA
写了一个简单的脚本,监控nimbus:
cluster_info = nimbus.getClusterInfo()
topology_id = None
for topology in cluster_info.topologies:
if topology.name == topology_name:
topology_id = topology.id
print topology_id
topology_info = nimbus.getTopologyInfo(topology_id)
但是,出了一个这样的问题:
Traceback (most recent call last):
File "monitor.py", line 55, in ?
stastic(nimbus_host, nimbus_port, topology_name, component_name)
File "monitor.py", line 33, in stastic
topology_info = nimbus.getTopologyInfo(topology_id)
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/Nimbus.py", line 505, in getTopologyInfo
return self.recv_getTopologyInfo()
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/Nimbus.py", line 523, in recv_getTopologyInfo
result.read(self._iprot)
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/Nimbus.py", line 2437, in read
self.success.read(iprot)
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/ttypes.py", line 2626, in read
_elem229.read(iprot)
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/ttypes.py", line 2502, in read
self.stats.read(iprot)
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/ttypes.py", line 2293, in read
self.specific.read(iprot)
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/ttypes.py", line 2182, in read
self.bolt.read(iprot)
File "/home/q/storm/storm-0.8.1-wip9/src/gen-py/storm/ttypes.py", line 1891, in read
_val86[_key92] = _val93
TypeError: unhashable instance
到网上找了一些资料,发现
https://github.com/nathanmarz/storm/issues/539
但是尝试storm自带的py , 还是不好使.。
明天改成java试试
java版 已经放到github上:
https://github.com/JulySouthWind/storm-monitor-tools