Advertisement
Guest User

Untitled

a guest
Mar 15th, 2021
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.47 KB | None | 0 0
  1. [root@NOC-test noc]# ./noc script --debug --pretty get_interfaces swa2-arch-staropim.msk.corp-qq
  2. 2021-03-15 13:24:18,194 [py.warnings] /opt/noc/core/profile/base.py:72: UserWarning: None: 'pattern_more' '^---MORE---' pattern must be of binary type. Support for text values will be removed in NOC 20.2
  3. warnings.warn(
  4.  
  5. 2021-03-15 13:24:18,294 [noc.core.ioloop.util] Setting up asyncio event loop policy
  6. 2021-03-15 13:24:18,294 [noc.core.ioloop.util] Setting up default event loop
  7. 2021-03-15 13:24:18,294 [asyncio] Using selector: EpollSelector
  8. 2021-03-15 13:24:18,294 [root] Starting DCS runner thread
  9. 2021-03-15 13:24:18,295 [asyncio] Using selector: EpollSelector
  10. 2021-03-15 13:24:18,295 [root] DCS runner thread is ready
  11. 2021-03-15 13:24:18,295 [root] Starting DCS consul://consul:8500/noc
  12. 2021-03-15 13:24:18,335 [noc.core.dcs.base] Resolve near service postgres
  13. 2021-03-15 13:24:18,336 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/postgres?passing=1&near=_agent
  14. 2021-03-15 13:24:18,339 [noc.core.http.client] HTTP Response 200
  15. 2021-03-15 13:24:18,339 [noc.core.dcs.base] Resolved near service postgres to ['10.1.253.210:5432']
  16. 2021-03-15 13:24:18,472 [noc.main.models.textindex] Adding FTS index for ip.vrf
  17. 2021-03-15 13:24:18,493 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
  18. 2021-03-15 13:24:18,526 [noc.main.models.doccategory] Registering Capability
  19. 2021-03-15 13:24:18,527 [noc.main.models.doccategory] Registering MetricType
  20. 2021-03-15 13:24:18,549 [noc.main.models.doccategory] Registering ConnectionType
  21. 2021-03-15 13:24:18,553 [noc.main.models.doccategory] Registering ObjectModel
  22. 2021-03-15 13:24:18,576 [noc.main.models.textindex] Adding FTS index for sa.managedobject
  23. 2021-03-15 13:24:18,584 [asyncio] Using selector: EpollSelector
  24. 2021-03-15 13:24:18,585 [noc.core.dcs.base] [mongo] Starting resolver (near=False)
  25. 2021-03-15 13:24:18,585 [noc.core.dcs.base] [mongo] Requesting changes from index 0
  26. 2021-03-15 13:24:18,585 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?passing=1
  27. 2021-03-15 13:24:18,587 [noc.core.http.client] HTTP Response 200
  28. 2021-03-15 13:24:18,587 [noc.core.dcs.base] [mongo] Index changed 0 -> 30197314. Applying changes
  29. 2021-03-15 13:24:18,587 [noc.core.dcs.base] [mongo] Set active services to: mongo: 10.1.253.210:27017
  30. 2021-03-15 13:24:18,588 [noc.core.dcs.base] [mongo] Stopping resolver
  31. 2021-03-15 13:24:18,588 [noc.core.mongo.connection] Connecting to MongoDB {'db': 'noc', 'username': 'noc', 'password': '********', 'authentication_source': 'noc', 'replicaSet': 'noc', 'readPreference': 'secondaryPreferred', 'maxIdleTimeMS': 60000, 'host': 'mongodb://noc:********@10.1.253.210:27017/noc'}
  32. 2021-03-15 13:24:18,634 [noc.core.loader.base] [script] Loading script Cisco.SMB.get_interfaces
  33. 2021-03-15 13:24:18,649 [noc.core.loader.base] [profile] Loading profile Cisco.SMB
  34. 2021-03-15 13:24:18,649 [py.warnings] /opt/noc/core/profile/base.py:72: UserWarning: Cisco.SMB: 'pattern_more' '^More:' pattern must be of binary type. Support for text values will be removed in NOC 20.2
  35. warnings.warn(
  36.  
  37. 2021-03-15 13:24:18,650 [py.warnings] /opt/noc/core/profile/base.py:78: UserWarning: Cisco.SMB: 'pattern_more' ' ' command must be of binary type. Support for text values will be removed in NOC 20.2
  38. warnings.warn(
  39.  
  40. 2021-03-15 13:24:18,650 [py.warnings] /opt/noc/core/profile/base.py:72: UserWarning: Cisco.SMB: 'pattern_more' '^Overwrite file \\[startup-config\\]' pattern must be of binary type. Support for text values will be removed in NOC 20.2
  41. warnings.warn(
  42.  
  43. 2021-03-15 13:24:18,650 [py.warnings] /opt/noc/core/profile/base.py:78: UserWarning: Cisco.SMB: 'pattern_more' 'y' command must be of binary type. Support for text values will be removed in NOC 20.2
  44. warnings.warn(
  45.  
  46. 2021-03-15 13:24:18,651 [script] [Cisco.SMB.get_interfaces|192.168.0.45] Filling get_version cache with {'vendor': 'Cisco Systems', 'platform': 'SG300-52MP 52-Port Gigabit Max-PoE Managed Switch', 'version': '1.4.11.2', 'image': None}
  47. 2021-03-15 13:24:18,651 [script] [Cisco.SMB.get_interfaces|192.168.0.45] Running. Input arguments: {}, timeout 3600
  48. 2021-03-15 13:24:18,651 [script] [Cisco.SMB.get_interfaces|192.168.0.45] Access method 'S' is not implemented. Passing to next method
  49. 2021-03-15 13:24:18,651 [script] [Cisco.SMB.get_interfaces|192.168.0.45] No '*' handler. Passing to next method
  50. 2021-03-15 13:24:18,683 [noc.core.debug] UNHANDLED EXCEPTION (2021-03-15 13:24:18.661248)
  51. PROCESS: ./commands/script.py
  52. VERSION: 20.4.3
  53. BRANCH: HEAD CHANGESET: c86766dc
  54. ERROR FINGERPRINT: 3642528d-595e-5b48-9cab-231ae9799efc
  55. WORKING DIRECTORY: /opt/noc
  56. EXCEPTION: <class 'noc.core.script.error.NotSupportedError'> Access preference 'S' is not supported
  57. START OF TRACEBACK
  58. ------------------------------------------------------------------------
  59. File: core/script/base.py (Line: 508)
  60. Function: call_method
  61. 501 if access_preference == "S*":
  62. 502 self.logger.info("Last S method break by timeout.")
  63. 503 raise self.snmp.TimeOutError
  64. 504 except NotImplementedError:
  65. 505 self.logger.debug(
  66. 506 "Access method '%s' is not implemented. Passing to next method", m
  67. 507 )
  68. 508 ==> raise self.NotSupportedError(
  69. 509 "Access preference '%s' is not supported" % access_preference[:-1]
  70. 510 )
  71. 511
  72. 512 def execute_cli(self, **kwargs):
  73. 513 """
  74. 514 Process script using CLI
  75. Variables:
  76. self =
  77. <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
  78. cli_handler =
  79. <bound method Script.execute_cli of <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>>
  80. snmp_handler =
  81. <bound method BaseScript.execute_snmp of <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>>
  82. fallback_handler = None
  83. kwargs = {}
  84. access_preference = 'S*'
  85. m = '*'
  86. handler = None
  87. ------------------------------------------------------------------------
  88. File: core/script/base.py (Line: 451)
  89. Function: execute
  90. 444 for f in self._execute_chain:
  91. 445 if f._match(self, self.version):
  92. 446 return f(self, **kwargs)
  93. 447 # Raise error
  94. 448 raise self.NotSupportedError()
  95. 449 else:
  96. 450 # New SNMP/CLI API
  97. 451 ==> return self.call_method(
  98. 452 cli_handler=self.execute_cli, snmp_handler=self.execute_snmp, **kwargs
  99. 453 )
  100. 454
  101. 455 def call_method(self, cli_handler=None, snmp_handler=None, fallback_handler=None, **kwargs):
  102. 456 """
  103. 457 Call function depending on access_preference
  104. Variables:
  105. self =
  106. <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
  107. kwargs = {}
  108. ------------------------------------------------------------------------
  109. File: core/script/base.py (Line: 307)
  110. Function: run
  111. 300 self.logger.info("Using cached result")
  112. 301 cache_hit = True
  113. 302 except KeyError:
  114. 303 pass
  115. 304 # Execute script
  116. 305 if not cache_hit:
  117. 306 try:
  118. 307 ==> result = self.execute(**self.args)
  119. 308 if self.cache and self.parent and result:
  120. 309 self.logger.info("Caching result")
  121. 310 self.set_cache(self.name, self.args, result)
  122. 311 finally:
  123. 312 if not self.parent:
  124. 313 # Close SNMP socket when necessary
  125. Variables:
  126. self =
  127. <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
  128. cache_hit = False
  129. ------------------------------------------------------------------------
  130. File: commands/script.py (Line: 149)
  131. Function: handle
  132. 142 name=script,
  133. 143 )
  134. 144 span_sample = 1 if update_spec or beef_output else 0
  135. 145 result = ""
  136. 146 if beef_output:
  137. 147 scr.start_tracking()
  138. 148 with Span(sample=span_sample, suppress_trace=span_sample):
  139. 149 ==> result = scr.run()
  140. 150 if pretty:
  141. 151 pprint.pprint(result)
  142. 152 elif yaml_o:
  143. 153 import sys
  144. 154
  145. 155 yaml.dump(result, sys.stdout)
  146. Variables:
  147. self = <__main__.Command object at 0x7f4efca31460>
  148. script = 'Cisco.SMB.get_interfaces'
  149. object_name = ['swa2-arch-staropim.msk.corp-qq']
  150. arguments = []
  151. pretty = True
  152. yaml_o = False
  153. use_snmp = True
  154. access_preference = None
  155. snmp_rate_limit = 0
  156. update_spec = None
  157. beef_output = None
  158. args = {}
  159. options = {}
  160. obj = <ManagedObject: swa2-arch-staropim.msk.corp-qq>
  161. credentials =
  162. {'access_preference': 'S',
  163. 'address': '192.168.0.45',
  164. 'cli_protocol': 'ssh',
  165. 'password': '_j2RNKU5!ig@drTw',
  166. 'path': None,
  167. 'raise_privileges': True,
  168. 'snmp_rate_limit': None,
  169. 'snmp_ro': 'p5v4Xnsi8BRO',
  170. 'snmp_version': 'v2c',
  171. 'super_password': None,
  172. 'user': 'prime'}
  173. script_class = <class 'noc.sa.profiles.Cisco.SMB.get_interfaces.Script'>
  174. caps =
  175. {'DB | Interfaces': 61,
  176. 'Network | CDP': True,
  177. 'Network | LLDP': True,
  178. 'Network | STP': True,
  179. 'SNMP': True,
  180. 'SNMP | Bulk': True,
  181. 'SNMP | IF-MIB': True,
  182. 'SNMP | IF-MIB | HC': True,
  183. 'SNMP | OID | EnterpriseID': 9,
  184. 'SNMP | v1': True,
  185. 'SNMP | v2c': True}
  186. version =
  187. {'caps': {'DB | Interfaces': 61,
  188. 'Network | CDP': True,
  189. 'Network | LLDP': True,
  190. 'Network | STP': True,
  191. 'SNMP': True,
  192. 'SNMP | Bulk': True,
  193. 'SNMP | IF-MIB': True,
  194. 'SNMP | IF-MIB | HC': True,
  195. 'SNMP | OID | EnterpriseID': 9,
  196. 'SNMP | v1': True,
  197. 'SNMP | v2c': True},
  198. 'image': None,
  199. 'platform': 'SG300-52MP 52-Port Gigabit Max-PoE Managed Switch',
  200. 'vendor': 'Cisco Systems',
  201. 'version': '1.4.11.2'}
  202. service = <__main__.ServiceStub object at 0x7f4ef27b2790>
  203. scr =
  204. <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
  205. span_sample = 0
  206. result = ''
  207. ------------------------------------------------------------------------
  208. File: core/management/base.py (Line: 78)
  209. Function: run_from_argv
  210. 71 self.no_progressbar = cmd_options.pop("no_progressbar", False)
  211. 72 if enable_profiling:
  212. 73 # Start profiler
  213. 74 import yappi
  214. 75
  215. 76 yappi.start()
  216. 77 try:
  217. 78 ==> return self.handle(*args, **cmd_options) or 0
  218. 79 except CommandError as e:
  219. 80 self.print(str(e))
  220. 81 return 1
  221. 82 except KeyboardInterrupt:
  222. 83 self.print("Ctrl+C")
  223. 84 return 3
  224. Variables:
  225. self = <__main__.Command object at 0x7f4efca31460>
  226. argv =
  227. ['--debug', '--pretty', 'get_interfaces', 'swa2-arch-staropim.msk.corp-qq']
  228. parser =
  229. ArgumentParser(prog='noc script', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
  230. options =
  231. Namespace(access_preference=None, arguments=[], beef_output=None, object_name=['swa2-arch-staropim.msk.corp-qq'], pretty=True, script=['get_interfaces'], snmp_rate_limit=0, update_spec=None, use_snmp=True, yaml_o=False)
  232. cmd_options =
  233. {'access_preference': None,
  234. 'arguments': [],
  235. 'beef_output': None,
  236. 'object_name': ['swa2-arch-staropim.msk.corp-qq'],
  237. 'pretty': True,
  238. 'script': ['get_interfaces'],
  239. 'snmp_rate_limit': 0,
  240. 'update_spec': None,
  241. 'use_snmp': True,
  242. 'yaml_o': False}
  243. args = ()
  244. loglevel = 'debug'
  245. enable_profiling = False
  246. show_metrics = False
  247. error_report = <function error_report at 0x7f4f424cd3a0>
  248. ------------------------------------------------------------------------
  249. END OF TRACEBACK
  250.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement