Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.20 KB | None | 0 0
  1. 2014-09-18 21:10:06,253 [noc.lib.nbsocket.basesocket] [ActivatorSocket 127.0.0.1:19701] Unhandled exception when calling <bound method ActivatorSocket.handle_read of <ActivatorSocket(0x8083d6e90, 127.0.0.1:19701, connected)>>
  2. 2014-09-18 21:10:06,262 [noc.lib.debug] UNHANDLED EXCEPTION (2014-09-18 21:10:06.253511)
  3. Working directory: /opt/noc
  4. <type 'exceptions.AttributeError'>
  5. 'TrapCollector' object has no attribute 'logger'
  6. START OF TRACEBACK
  7. ------------------------------------------------------------------------
  8. File: /opt/noc/lib/nbsocket/basesocket.py (Line: 173)
  9. Function: info
  10. 166 Emit info-level log message.
  11. 167
  12. 168 :param msg: Message
  13. 169 :type msg: str
  14. 170 """
  15. 171 warnings.warn("Using deprecated Socket.info() method",
  16. 172 DeprecationWarning, stacklevel=2)
  17. 173 ==> self.logger.info(msg)
  18. 174
  19. 175 def error(self, msg):
  20. 176 """
  21. 177 Emit error-level log message.
  22. 178
  23. 179 :param msg: Message
  24. Variables:
  25. msg = 'Initializing at 0.0.0.0:162'
  26. self = <TrapCollector(0x80a229e10, init)>
  27. ------------------------------------------------------------------------
  28. File: /opt/noc/sa/activator/trap_collector.py (Line: 35)
  29. Function: __init__
  30. 28 "oid": "value"
  31. 29 ....
  32. 30 }
  33. 31 """
  34. 32 name = "TrapCollector"
  35. 33
  36. 34 def __init__(self, activator, address, port, log_traps=False):
  37. 35 ==> self.info("Initializing at %s:%s" % (address, port))
  38. 36 self.collector_signature = "%s:%s" % (address, port)
  39. 37 self.log_traps = log_traps
  40. 38 ListenUDPSocket.__init__(self, activator.factory, address, port)
  41. 39 EventCollector.__init__(self, activator)
  42. 40
  43. 41 def on_read(self, whole_msg, address, port):
  44. Variables:
  45. activator = <noc.sa.activator.activator.Activator object at 0x807e8ee50>
  46. log_traps = True
  47. port = 162
  48. self = <TrapCollector(0x80a229e10, init)>
  49. address = '0.0.0.0'
  50. ------------------------------------------------------------------------
  51. File: /opt/noc/sa/activator/activator.py (Line: 291)
  52. Function: start_trap_collectors
  53. 284 logging.info("Using pysnmp trap parser")
  54. 285 from noc.sa.activator.pysnmp_trap_collector import TrapCollector
  55. 286 log_traps = self.config.getboolean("main", "log_snmp_traps")
  56. 287 self.trap_collectors = [
  57. 288 TrapCollector(self, ip, port, log_traps)
  58. 289 for ip, port
  59. 290 in self.resolve_addresses(
  60. 291 ==> self.config.get("activator", "listen_traps"), 162)
  61. 292 ]
  62. 293
  63. 294 def stop_trap_collectors(self):
  64. 295 """
  65. 296 Stop SNMP Trap Collectors
  66. 297 """
  67. Variables:
  68. self = <noc.sa.activator.activator.Activator object at 0x807e8ee50>
  69. ip = '0.0.0.0'
  70. log_traps = True
  71. port = 162
  72. TrapCollector = <class 'noc.sa.activator.trap_collector.TrapCollector'>
  73. ------------------------------------------------------------------------
  74. File: /opt/noc/sa/activator/activator.py (Line: 263)
  75. Function: on_ESTABLISHED_enter
  76. 256 to_refresh_filters = self.to_ping
  77. 257 self.next_mappings_update = None
  78. 258 self.scripts_processed = 0
  79. 259 self.scripts_failed = 0
  80. 260 # Check does our instance is designated to listen
  81. 261 if self.to_listen:
  82. 262 if self.config.get("activator", "listen_traps"):
  83. 263 ==> self.start_trap_collectors()
  84. 264 to_refresh_filters = True
  85. 265 if self.config.get("activator", "listen_syslog"):
  86. 266 self.start_syslog_collectors()
  87. 267 to_refresh_filters = True
  88. 268 if self.config.get("activator", "listen_pm_data"):
  89. 269 self.start_pm_data_collectors()
  90. Variables:
  91. self = <noc.sa.activator.activator.Activator object at 0x807e8ee50>
  92. to_refresh_filters = False
  93. ------------------------------------------------------------------------
  94. File: /opt/noc/lib/fsm.py (Line: 78)
  95. Function: call_state_handler
  96. 71 return getattr(self, name)
  97. 72 except:
  98. 73 return None
  99. 74
  100. 75 def call_state_handler(self, state, event, *args):
  101. 76 h = self.get_state_handler(state, event)
  102. 77 if h:
  103. 78 ==> apply(h, args)
  104. 79
  105. 80 def get_state(self):
  106. 81 return self._current_state
  107. 82
  108. 83 def set_state(self, state):
  109. 84 if state == self._current_state:
  110. Variables:
  111. h =
  112. <bound method Activator.on_ESTABLISHED_enter of <noc.sa.activator.activator.Activator object at 0x807e8ee50>>
  113. state = 'ESTABLISHED'
  114. args = ()
  115. event = 'enter'
  116. self = <noc.sa.activator.activator.Activator object at 0x807e8ee50>
  117. ------------------------------------------------------------------------
  118. File: /opt/noc/lib/fsm.py (Line: 94)
  119. Function: set_state
  120. 87 if state not in self.STATES:
  121. 88 raise FSMStateError(state)
  122. 89 if self._current_state:
  123. 90 self.call_state_handler(self._current_state, "exit")
  124. 91 self._current_state = state
  125. 92 self._state_enter_time = time.time()
  126. 93 self._state_exit_time = None
  127. 94 ==> self.call_state_handler(state, "enter")
  128. 95
  129. 96 def set_timeout(self, timeout):
  130. 97 self.debug("set_timeout(%s)" % timeout)
  131. 98 self._state_exit_time = time.time() + timeout
  132. 99
  133. 100 ##
  134. Variables:
  135. state = 'ESTABLISHED'
  136. self = <noc.sa.activator.activator.Activator object at 0x807e8ee50>
  137. ------------------------------------------------------------------------
  138. File: /opt/noc/lib/fsm.py (Line: 108)
  139. Function: event
  140. 101 ## Send event to FSM
  141. 102 ##
  142. 103 def event(self, event):
  143. 104 self.debug("event(%s)" % event)
  144. 105 if event not in self.STATES[self._current_state]:
  145. 106 raise FSMEventError(self._current_state, event)
  146. 107 self.call_state_handler(self._current_state, event)
  147. 108 ==> self.set_state(self.STATES[self._current_state][event])
  148. 109
  149. 110 def tick(self):
  150. 111 """
  151. 112 Method should be called in event loop every second
  152. 113 to process timeout and tick events
  153. 114 """
  154. Variables:
  155. self = <noc.sa.activator.activator.Activator object at 0x807e8ee50>
  156. event = 'establish'
  157. ------------------------------------------------------------------------
  158. File: /opt/noc/sa/activator/activator.py (Line: 562)
  159. Function: auth_callback
  160. 555 if self.get_state() != "REGISTRED":
  161. 556 return
  162. 557 if error:
  163. 558 logging.error("Authentication failed: %s" % error.text)
  164. 559 self.event("error")
  165. 560 return
  166. 561 logging.info("Authenticated")
  167. 562 ==> self.event("establish")
  168. 563 name = self.config.get("activator", "name")
  169. 564 logging.info("Authenticating as %s" % name)
  170. 565 r = AuthRequest(
  171. 566 name=name,
  172. 567 digest=get_digest(name,
  173. 568 self.config.get("activator", "secret"),
  174. Variables:
  175. self = <noc.sa.activator.activator.Activator object at 0x807e8ee50>
  176. transaction = <noc.sa.rpc.Transaction object at 0x80a229690>
  177. response = <noc.sa.protocols.sae_pb2.AuthResponse object at 0x8083ac910>
  178. error = None
  179. ------------------------------------------------------------------------
  180. File: /opt/noc/sa/rpc.py (Line: 98)
  181. Function: commit
  182. 91 self.factory = factory
  183. 92 self.id = id
  184. 93 self.method = method
  185. 94 self.callback = callback
  186. 95
  187. 96 def commit(self, response=None, error=None):
  188. 97 if self.callback:
  189. 98 ==> self.callback(self, response, error)
  190. 99 self.factory.delete_transaction(self.id)
  191. 100
  192. 101 def rollback(self, error):
  193. 102 self.commit(error=error)
  194. 103
  195. 104
  196. Variables:
  197. self = <noc.sa.rpc.Transaction object at 0x80a229690>
  198. response = <noc.sa.protocols.sae_pb2.AuthResponse object at 0x8083ac910>
  199. error = None
  200. ------------------------------------------------------------------------
  201. File: /opt/noc/sa/rpc.py (Line: 442)
  202. Function: rpc_handle_response
  203. 435 logging.error("Invalid transaction: %s" % id)
  204. 436 return
  205. 437 t = self.transactions[id]
  206. 438 method = self.service.GetDescriptor().FindMethodByName(t.method)
  207. 439 if method:
  208. 440 res = self.service.GetResponseClass(method)()
  209. 441 res.ParseFromString(response.serialized_response)
  210. 442 ==> t.commit(response=res)
  211. 443 else:
  212. 444 logging.error("Invalid method: %s" % t.method)
  213. 445 t.rollback()
  214. 446
  215. 447 def rpc_handle_error(self, id, error):
  216. 448 logging.debug("rpc_handle_error:\nid: %s\n%s" % (id, str(error)))
  217. Variables:
  218. res = <noc.sa.protocols.sae_pb2.AuthResponse object at 0x8083ac910>
  219. self = <ActivatorSocket(0x8083d6e90, 127.0.0.1:19701, connected)>
  220. response = <noc.sa.protocols.sae_pb2.Response object at 0x8083ac6e0>
  221. method = <google.protobuf.descriptor.MethodDescriptor object at 0x8071e0490>
  222. t = <noc.sa.rpc.Transaction object at 0x80a229690>
  223. id = 252240631
  224. ------------------------------------------------------------------------
  225. File: /opt/noc/sa/rpc.py (Line: 405)
  226. Function: on_read
  227. 398 self.stat_rpc_errors += 1
  228. 399 self.rpc_handle_error(msg.id, msg.error)
  229. 400 elif msg.request.ByteSize():
  230. 401 self.stat_rpc_requests += 1
  231. 402 self.rpc_handle_request(msg.id, msg.request)
  232. 403 elif msg.response.ByteSize():
  233. 404 self.stat_rpc_responses += 1
  234. 405 ==> self.rpc_handle_response(msg.id, msg.response)
  235. 406
  236. 407 def rpc_handle_request(self, id, request):
  237. 408 logging.debug("rpc_handle_request: %s" % request.method)
  238. 409 if id in self.transactions:
  239. 410 self.send_error(id, ERR_TRANSACTION_EXISTS,
  240. 411 "Transaction %s is already exists" % id)
  241. Variables:
  242. msg = <noc.sa.protocols.sae_pb2.Message object at 0x8083ac590>
  243. self = <ActivatorSocket(0x8083d6e90, 127.0.0.1:19701, connected)>
  244. data = '\x08\xf7\xc5\xa3x\x1a\x02\n\x00'
  245. ------------------------------------------------------------------------
  246. File: /opt/noc/lib/nbsocket/protocols/base.py (Line: 34)
  247. Function: feed
  248. 27 completed PDU.
  249. 28
  250. 29 :param data: Raw data portion
  251. 30 :type data: str
  252. 31 """
  253. 32 self.in_buffer += data
  254. 33 for pdu in self.parse_pdu():
  255. 34 ==> self.callback(pdu)
  256. 35
  257. 36 def parse_pdu(self):
  258. 37 """
  259. 38 Scan self.in_buffer, detect all completed PDUs, then remove
  260. 39 them from buffer and return as list or yield them
  261. 40
  262. Variables:
  263. pdu = '\x08\xf7\xc5\xa3x\x1a\x02\n\x00'
  264. data = '\x00\x00\x00\t\x08\xf7\xc5\xa3x\x1a\x02\n\x00'
  265. self = <noc.sa.rpc.RPCProtocol object at 0x80a218150>
  266. ------------------------------------------------------------------------
  267. File: /opt/noc/lib/nbsocket/connectedtcpsocket.py (Line: 87)
  268. Function: handle_read
  269. 80 return
  270. 81 raise socket.error, why
  271. 82 if not data:
  272. 83 self.close()
  273. 84 return
  274. 85 self.update_status()
  275. 86 if self.protocol_class:
  276. 87 ==> self.protocol.feed(data)
  277. 88 else:
  278. 89 self.on_read(data)
  279. 90
  280. 91 def handle_write(self):
  281. 92 if not self.is_connected:
  282. 93 try:
  283. Variables:
  284. self = <ActivatorSocket(0x8083d6e90, 127.0.0.1:19701, connected)>
  285. data = '\x00\x00\x00\t\x08\xf7\xc5\xa3x\x1a\x02\n\x00'
  286. ------------------------------------------------------------------------
  287. File: /opt/noc/lib/nbsocket/socketfactory.py (Line: 95)
  288. Function: guarded_socket_call
  289. 88 Wrapper for safe call of socket method. Handles and reports
  290. 89 socket errors.
  291. 90
  292. 91 :return: Call status
  293. 92 :rtype: Bool
  294. 93 """
  295. 94 try:
  296. 95 ==> method()
  297. 96 except Exception:
  298. 97 exc = get_socket_error()
  299. 98 try:
  300. 99 if exc:
  301. 100 socket.on_error(exc)
  302. 101 else:
  303. Variables:
  304. self = <noc.lib.nbsocket.socketfactory.SocketFactory object at 0x80722cb90>
  305. socket = <ActivatorSocket(0x8083d6e90, 127.0.0.1:19701, connected)>
  306. exc = None
  307. method =
  308. <bound method ActivatorSocket.handle_read of <ActivatorSocket(0x8083d6e90, 127.0.0.1:19701, connected)>>
  309. ------------------------------------------------------------------------
  310. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement