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

snmpsimd.py: Value evaluation error for subprocess and hexlified values #68

Open
pieterheydenrych opened this issue Mar 7, 2019 · 1 comment

Comments

@pieterheydenrych
Copy link

pieterheydenrych commented Mar 7, 2019

I encounter a value evaluation error when using the subprocess variation module to update hexlified values in .snmprec files.

I'm using HOST-RESOURCES-MIB::hrSystemDate for illustration with the use case to return the current timestamp whenever polled. The value is a RFC2579 DateAndTime octet string.

Raw capture:

1.3.6.1.2.1.25.1.2.1|4x|07e30307001b01152b0000

snmpwalk result using the default raw capture:

HOST-RESOURCES-MIB::hrSystemDate.1 = STRING: 2019-3-7,0:27:1.21,+0:0

I now update the snmprec to use subprocess to provide the octetstring. snmpsimd logs the following error:

ERROR data error at /home/someuser/pydev/snmpsim/data/snmpwalk/host.snmprec controller for 1.3.6.1.2.1.25.1.2: value evaluation error for tag '4', value b'07e30307001b01152b0000\n'

The issue remains no matter which approach I use e.g.

1.3.6.1.2.1.25.1.2.1|4x:subprocess|get_date.py  <=== this is the desired approach
1.3.6.1.2.1.25.1.2.1|4x:subprocess|echo 07e30307001b01152b0000
1.3.6.1.2.1.25.1.2.1|4:subprocess|echo hexvalue=07e30307001b01152b0000

The last example doesn't result in an error, but it ends up passing a hexflified value for the whole 'hexvalue=07e30307001b01152b0000' string which doesn't produce the desired outcome. I don't believe hexvalue is supported for subprocess as it's not mentioned in the docs.

I can reproduce the issue on versions 0.4.6 and 0.4.7 on RHEL Python 3.6/3.7.

UPDATED: It works when running snmpsim on Python 2.7.
Is there anything to be done to help it along in Python 3?

Thanks!
Pieter

@pieterheydenrych pieterheydenrych changed the title Value evaluation error for subprocess and hexlified values snmpsimd.py: Value evaluation error for subprocess and hexlified values Mar 7, 2019
@etingof
Copy link
Owner

etingof commented Apr 12, 2019

Thank you for raising this and sorry for it takes time!

There is a fix in the release candidate as well as in master to address this problem.

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

2 participants