Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root@NOC-test noc]# ./noc script --debug --pretty get_interfaces swa2-arch-staropim.msk.corp-qq
- 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
- warnings.warn(
- 2021-03-15 13:24:18,294 [noc.core.ioloop.util] Setting up asyncio event loop policy
- 2021-03-15 13:24:18,294 [noc.core.ioloop.util] Setting up default event loop
- 2021-03-15 13:24:18,294 [asyncio] Using selector: EpollSelector
- 2021-03-15 13:24:18,294 [root] Starting DCS runner thread
- 2021-03-15 13:24:18,295 [asyncio] Using selector: EpollSelector
- 2021-03-15 13:24:18,295 [root] DCS runner thread is ready
- 2021-03-15 13:24:18,295 [root] Starting DCS consul://consul:8500/noc
- 2021-03-15 13:24:18,335 [noc.core.dcs.base] Resolve near service postgres
- 2021-03-15 13:24:18,336 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/postgres?passing=1&near=_agent
- 2021-03-15 13:24:18,339 [noc.core.http.client] HTTP Response 200
- 2021-03-15 13:24:18,339 [noc.core.dcs.base] Resolved near service postgres to ['10.1.253.210:5432']
- 2021-03-15 13:24:18,472 [noc.main.models.textindex] Adding FTS index for ip.vrf
- 2021-03-15 13:24:18,493 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
- 2021-03-15 13:24:18,526 [noc.main.models.doccategory] Registering Capability
- 2021-03-15 13:24:18,527 [noc.main.models.doccategory] Registering MetricType
- 2021-03-15 13:24:18,549 [noc.main.models.doccategory] Registering ConnectionType
- 2021-03-15 13:24:18,553 [noc.main.models.doccategory] Registering ObjectModel
- 2021-03-15 13:24:18,576 [noc.main.models.textindex] Adding FTS index for sa.managedobject
- 2021-03-15 13:24:18,584 [asyncio] Using selector: EpollSelector
- 2021-03-15 13:24:18,585 [noc.core.dcs.base] [mongo] Starting resolver (near=False)
- 2021-03-15 13:24:18,585 [noc.core.dcs.base] [mongo] Requesting changes from index 0
- 2021-03-15 13:24:18,585 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?passing=1
- 2021-03-15 13:24:18,587 [noc.core.http.client] HTTP Response 200
- 2021-03-15 13:24:18,587 [noc.core.dcs.base] [mongo] Index changed 0 -> 30197314. Applying changes
- 2021-03-15 13:24:18,587 [noc.core.dcs.base] [mongo] Set active services to: mongo: 10.1.253.210:27017
- 2021-03-15 13:24:18,588 [noc.core.dcs.base] [mongo] Stopping resolver
- 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'}
- 2021-03-15 13:24:18,634 [noc.core.loader.base] [script] Loading script Cisco.SMB.get_interfaces
- 2021-03-15 13:24:18,649 [noc.core.loader.base] [profile] Loading profile Cisco.SMB
- 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
- warnings.warn(
- 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
- warnings.warn(
- 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
- warnings.warn(
- 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
- warnings.warn(
- 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}
- 2021-03-15 13:24:18,651 [script] [Cisco.SMB.get_interfaces|192.168.0.45] Running. Input arguments: {}, timeout 3600
- 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
- 2021-03-15 13:24:18,651 [script] [Cisco.SMB.get_interfaces|192.168.0.45] No '*' handler. Passing to next method
- 2021-03-15 13:24:18,683 [noc.core.debug] UNHANDLED EXCEPTION (2021-03-15 13:24:18.661248)
- PROCESS: ./commands/script.py
- VERSION: 20.4.3
- BRANCH: HEAD CHANGESET: c86766dc
- ERROR FINGERPRINT: 3642528d-595e-5b48-9cab-231ae9799efc
- WORKING DIRECTORY: /opt/noc
- EXCEPTION: <class 'noc.core.script.error.NotSupportedError'> Access preference 'S' is not supported
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: core/script/base.py (Line: 508)
- Function: call_method
- 501 if access_preference == "S*":
- 502 self.logger.info("Last S method break by timeout.")
- 503 raise self.snmp.TimeOutError
- 504 except NotImplementedError:
- 505 self.logger.debug(
- 506 "Access method '%s' is not implemented. Passing to next method", m
- 507 )
- 508 ==> raise self.NotSupportedError(
- 509 "Access preference '%s' is not supported" % access_preference[:-1]
- 510 )
- 511
- 512 def execute_cli(self, **kwargs):
- 513 """
- 514 Process script using CLI
- Variables:
- self =
- <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
- cli_handler =
- <bound method Script.execute_cli of <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>>
- snmp_handler =
- <bound method BaseScript.execute_snmp of <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>>
- fallback_handler = None
- kwargs = {}
- access_preference = 'S*'
- m = '*'
- handler = None
- ------------------------------------------------------------------------
- File: core/script/base.py (Line: 451)
- Function: execute
- 444 for f in self._execute_chain:
- 445 if f._match(self, self.version):
- 446 return f(self, **kwargs)
- 447 # Raise error
- 448 raise self.NotSupportedError()
- 449 else:
- 450 # New SNMP/CLI API
- 451 ==> return self.call_method(
- 452 cli_handler=self.execute_cli, snmp_handler=self.execute_snmp, **kwargs
- 453 )
- 454
- 455 def call_method(self, cli_handler=None, snmp_handler=None, fallback_handler=None, **kwargs):
- 456 """
- 457 Call function depending on access_preference
- Variables:
- self =
- <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
- kwargs = {}
- ------------------------------------------------------------------------
- File: core/script/base.py (Line: 307)
- Function: run
- 300 self.logger.info("Using cached result")
- 301 cache_hit = True
- 302 except KeyError:
- 303 pass
- 304 # Execute script
- 305 if not cache_hit:
- 306 try:
- 307 ==> result = self.execute(**self.args)
- 308 if self.cache and self.parent and result:
- 309 self.logger.info("Caching result")
- 310 self.set_cache(self.name, self.args, result)
- 311 finally:
- 312 if not self.parent:
- 313 # Close SNMP socket when necessary
- Variables:
- self =
- <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
- cache_hit = False
- ------------------------------------------------------------------------
- File: commands/script.py (Line: 149)
- Function: handle
- 142 name=script,
- 143 )
- 144 span_sample = 1 if update_spec or beef_output else 0
- 145 result = ""
- 146 if beef_output:
- 147 scr.start_tracking()
- 148 with Span(sample=span_sample, suppress_trace=span_sample):
- 149 ==> result = scr.run()
- 150 if pretty:
- 151 pprint.pprint(result)
- 152 elif yaml_o:
- 153 import sys
- 154
- 155 yaml.dump(result, sys.stdout)
- Variables:
- self = <__main__.Command object at 0x7f4efca31460>
- script = 'Cisco.SMB.get_interfaces'
- object_name = ['swa2-arch-staropim.msk.corp-qq']
- arguments = []
- pretty = True
- yaml_o = False
- use_snmp = True
- access_preference = None
- snmp_rate_limit = 0
- update_spec = None
- beef_output = None
- args = {}
- options = {}
- obj = <ManagedObject: swa2-arch-staropim.msk.corp-qq>
- credentials =
- {'access_preference': 'S',
- 'address': '192.168.0.45',
- 'cli_protocol': 'ssh',
- 'password': '_j2RNKU5!ig@drTw',
- 'path': None,
- 'raise_privileges': True,
- 'snmp_rate_limit': None,
- 'snmp_ro': 'p5v4Xnsi8BRO',
- 'snmp_version': 'v2c',
- 'super_password': None,
- 'user': 'prime'}
- script_class = <class 'noc.sa.profiles.Cisco.SMB.get_interfaces.Script'>
- caps =
- {'DB | Interfaces': 61,
- 'Network | CDP': True,
- 'Network | LLDP': True,
- 'Network | STP': True,
- 'SNMP': True,
- 'SNMP | Bulk': True,
- 'SNMP | IF-MIB': True,
- 'SNMP | IF-MIB | HC': True,
- 'SNMP | OID | EnterpriseID': 9,
- 'SNMP | v1': True,
- 'SNMP | v2c': True}
- version =
- {'caps': {'DB | Interfaces': 61,
- 'Network | CDP': True,
- 'Network | LLDP': True,
- 'Network | STP': True,
- 'SNMP': True,
- 'SNMP | Bulk': True,
- 'SNMP | IF-MIB': True,
- 'SNMP | IF-MIB | HC': True,
- 'SNMP | OID | EnterpriseID': 9,
- 'SNMP | v1': True,
- 'SNMP | v2c': True},
- 'image': None,
- 'platform': 'SG300-52MP 52-Port Gigabit Max-PoE Managed Switch',
- 'vendor': 'Cisco Systems',
- 'version': '1.4.11.2'}
- service = <__main__.ServiceStub object at 0x7f4ef27b2790>
- scr =
- <noc.sa.profiles.Cisco.SMB.get_interfaces.Script object at 0x7f4ef164b790>
- span_sample = 0
- result = ''
- ------------------------------------------------------------------------
- File: core/management/base.py (Line: 78)
- Function: run_from_argv
- 71 self.no_progressbar = cmd_options.pop("no_progressbar", False)
- 72 if enable_profiling:
- 73 # Start profiler
- 74 import yappi
- 75
- 76 yappi.start()
- 77 try:
- 78 ==> return self.handle(*args, **cmd_options) or 0
- 79 except CommandError as e:
- 80 self.print(str(e))
- 81 return 1
- 82 except KeyboardInterrupt:
- 83 self.print("Ctrl+C")
- 84 return 3
- Variables:
- self = <__main__.Command object at 0x7f4efca31460>
- argv =
- ['--debug', '--pretty', 'get_interfaces', 'swa2-arch-staropim.msk.corp-qq']
- parser =
- ArgumentParser(prog='noc script', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
- options =
- 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)
- cmd_options =
- {'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}
- args = ()
- loglevel = 'debug'
- enable_profiling = False
- show_metrics = False
- error_report = <function error_report at 0x7f4f424cd3a0>
- ------------------------------------------------------------------------
- END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement