snmpsim icon indicating copy to clipboard operation
snmpsim copied to clipboard

Problem using snmpsim subprocess module

Open roma-p opened this issue 6 years ago • 2 comments

Hi! I'm currently running snmpsim 0.4.7 on Python 2.7 and I ame facing a problem using the supbrocess module :

my snmprec file contains the following line : 1.3.6.1.2.1.1.3.0|2:subprocess|echo 1

but it doens't seems to work as expected since a snmp set on this oid return the following error : No Such Instance currently exists at this OID

the log gave us some insight :

2019-05-22T14:26:42.32 snmpsimd: Request var-binds: 1.3.6.1.2.1.1.3.0=<2>, flags: EXACT, SET
2019-05-22T14:26:42.32 snmpsimd: subprocess: executing external process "echo 1"
2019-05-22T14:26:42.32 snmpsimd: ERROR data error at /dossier_config/private.snmprec controller for 1.3.6.1.2.1.1.3.0: value evaluation error for tag '2', value '\n'
2019-05-22T14:26:42.32 snmpsimd: Response var-binds: 1.3.6.1.2.1.1.3.0=<No Such Instance currently exists at this OID>

I tried to exectute the subprocess example described in the documentation : 1.3.6.1.2.1.1.3.0|2:subprocess|date +%s But I ran on a type error (trying to set a string instead of an integer), the string beeing : "Fri May 24 11:32:37 CEST 2019" as if the statement executed by subprocess was sliced on first space.

roma-p avatar May 24 '19 09:05 roma-p

I seem to recall similar bug fixed in the past... Could you try your setup with the upcoming snmpsim version 0.4.8 please? If it still fails, we will have to look into that.

Thanks!

etingof avatar May 27 '19 07:05 etingof

Thanks for your anwser ! We did so but it didn't solve the problem, logs are a bit different though :

snmpsimd: Request var-binds: 1.3.6.1.4.1.38355.200.3.1.3.2=<3>, flags: EXACT, SET
snmpsimd: subprocess: executing external process "./dossier_config/prog_shell.sh 3"
snmpsimd: ERROR data error at /dossier_config/private.snmprec controller for 1.3.6.1.4.1.38355.200.3.1.3.2: value evaluation error for tag '2', value '\n': Can't coerce '\n' into integer: '\n'
snmpsimd: Response var-binds: 1.3.6.1.4.1.38355.200.3.1.3.2=<No Such Instance currently exists at this OID>

roma-p avatar Jun 03 '19 14:06 roma-p