Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to record from MIB #163

Open
thomasbromehead opened this issue Feb 2, 2021 · 6 comments
Open

Unable to record from MIB #163

thomasbromehead opened this issue Feb 2, 2021 · 6 comments

Comments

@thomasbromehead
Copy link

Hi Ilya,
Thomas again... lol
Been trying to create .snmprec files from MIB files using snmpsim-record-mibs but I'm getting the following error:

len(args.string_pool)
*** TypeError: object of type 'NoneType' has no len()

Tried with several MIBs including SNMPv2-MIB which is provided by default in /site-packages/snmpsim etc as well as a correctly formatted one from a DAHUA camera.
Set a breakpoint with PDB and couldn't fathom why args.string_pool was NoneType, this is what I get when I call args.string_pool:

`(Pdb) args.string_pool
syntax = <DisplayString schema object, tagSet <TagSet object, tags 0:0:4>, subtypeSpec <ConstraintsIntersection object, consts <ValueSizeConstraint object, consts 0, 65535>, <ValueSizeConstraint object, consts 0, 255>, <ValueSizeConstraint object, consts 0, 255>>, encoding iso-8859-1>
hint = '# Scalar SNMPv2-MIB::sysDescr (type DisplayString)\r\n'
automatic_values = 5000

argsseems like a very weird object, I can call non-existing methods on it, even on args.string_pool:
args.string_pool.asdadasda yields the same result as above...

This is the stacktrace:
Traceback (most recent call last): File "/home/thomas/snmp-project/venv/bin/snmpsim-record-mibs", line 8, in <module> sys.exit(main()) File "/home/thomas/snmp-project/venv/lib/python3.8/site-packages/snmpsim/commands/mib2rec.py", line 472, in main val = get_value(node.syntax, hint) File "/home/thomas/snmp-project/venv/lib/python3.8/site-packages/snmpsim/commands/mib2rec.py", line 240, in get_value val = ' '.join([args.string_pool[random.randrange(0, len(args.string_pool))] File "/home/thomas/snmp-project/venv/lib/python3.8/site-packages/snmpsim/commands/mib2rec.py", line 240, in <listcomp> val = ' '.join([args.string_pool[random.randrange(0, len(args.string_pool))] TypeError: object of type 'NoneType' has no len()

@wanglong001
Copy link

+1

image

@BURNI80
Copy link

BURNI80 commented Sep 14, 2023

I have this error pls help
image

@lextm
Copy link

lextm commented Sep 16, 2023

snmpsim-lextudio version 1.0.3 contains the fix.

@BURNI80 You didn't compile AGENTX-MIB properly and mibdump --destination-directory=pysnmp_mibs ./AGENTX-MIB.txt is necessary to ensure you use the proper MIB document and compile it to .py. Then your snmpsim-record-mibs command might start to work.

You are welcome to read etingof/pysnmp/issues/429 to learn more.

@BURNI80
Copy link

BURNI80 commented Sep 18, 2023

Thank you!

Why when I execute: snmpsim-record-mibs --mib-module=BRIDGE-MIB it ask me for values?

image

What do I have to write?

@lextm
Copy link

lextm commented Sep 18, 2023

@BURNI80 if you read the actual MIB documents, you will see that dot1dBaseBridgeAddress is of the type MacAddress, which in turn is OCTET STRING (SIZE (6))

https://github.com/lextudio/sharpsnmppro-mib/blob/master/SNMPv2-TC.txt#L92

So when prompted to input value, you might use something like AAAAAA to meet the constraint.

Similarly you need the following (and more),

  • A value like 600 for dot1dStpBridgeMaxAge.
  • A value like 100 for dot1dStpBridgeHelloTime.
  • A value like 400 for dot1dStpBridgeForwardDelay.
  • A value like aa for dot1dStpPortDesignatedPort.

@BURNI80
Copy link

BURNI80 commented Sep 19, 2023

@lextm

Thanks!!! Anyway to do it full automatic?

What command I need to compile AGENTX-MIB.py to a .snmprec file?

Any idea of why some mibs return 0 OIDs?
image

And why is generated like this? I mean, with taht strange OIDs
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants