question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

State of local MIB -> JSON support?

See original GitHub issue

Hi, wondering about the state of JSON support. Noticed it’s not in v0.0.7, so pulling off of master branch. Trying to generate JSON files from local MIBs but am not having success. The index gets generated but there’s no content in it. Using the following code:

def transform_mibs_to_json(self, specific_mibs=None, exclude_mibs=['test-mib.my']):
	mib_names = []
	if specific_mibs is None:
		for filename in os.listdir(self.local_mib_dir):
			try: filename.rindex('.my', -3)
			except: continue
			mib_names.append(filename)
	else:
		mib_names = specific_mibs.copy()
	try:
		mib_compiler = MibCompiler(
			SmiV1CompatParser(),
			JsonCodeGen(),
			FileWriter(self.local_json_dir).setOptions(suffix='.json')
		)
		mib_compiler.addSources(FileReader(self.local_mib_dir, recursive=True))
		mib_stubs = JsonCodeGen.baseMibs
		searchers = [AnyFileSearcher(self.local_json_dir).setOptions(exts=['.json']), StubSearcher(*mib_stubs)]
		mib_compiler.addSearchers(*searchers)
		if not os.path.isdir(self.local_json_dir):
			os.makedirs(self.local_json_dir)
		processed = mib_compiler.compile(
			*mib_names,
			**dict(
				noDeps=False,
				rebuild=True,
				genTexts=True,
				writeMibs=True,
				ignoreErrors=False
			)
		)
		mib_compiler.buildIndex(
			processed,
			ignoreErrors=False
		)
	except error.PySmiError:
		sys.stderr.write('ERROR: %s\n' % sys.exc_info()[1])
		sys.exit(-1)

See anything wrong in usage? Will try and submit a fix if it’s a bug. Any pointers or thoughts?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
etingofcommented, Feb 17, 2017

My guess is that pysmi compiler can’t find dependent MIBs. To figure that out you should look into the processed dictionary – it carries status and indicates missing dependencies.

My other suggestion would be to enable debugging:

from pysmi import debug
debug.setLogger(debug.Debug('reader', 'searcher', 'compiler'))

so it will show you (on stderr) which MIBs it wants to load, where it tries to look them up and ultimately failed.

Once you give it access to all MIBs your MIB depends on, it should be able to compile everything into JSON. Let me know if you need help with this.

0reactions
remingtonccommented, Apr 5, 2018

Closing as conversion of MIBs to JSON is supported and continuing issue is tangential.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Network Management Interfaces - NVIDIA Networking Docs
Mellanox private MIBs. Standard MIBs. The following table presents the supported textual conventions and conformance MIBs: MIB, Standard.
Read more >
python-pysmi(1) - Arch manual pages
The PySMI library and tools are designed to parse, verify and transform SNMP SMI MIB modules from their original ASN.1 form into JSON...
Read more >
SNMP MIBs and Traps Supported by Junos OS
Standard MIB Exceptions Platforms IEEE, 802.1ag, Connectivity Fault Management EX Series, MX Series... RFC 1901, Introduction to Community‑based SNMPv2 No exceptions All platforms RFC 3621, Power...
Read more >
K13322: Overview of BIG-IP MIB files - AskF5
F5-BIGIP-LOCAL-MIB.txt, Defines LTM objects, such as virtual servers, pools, nodes, profiles, SNATs, health monitors, and iRules.
Read more >
MIB File ePMP 1000 - Cambium Support Center
Trap catches JSON configuration export state. This state is indicated by the included value of cambiumJSONCfgExportError. Device Allocation: AP, SM.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found