Not dumping to .snmprec and not populating SQL table
thomasbromehead opened this issue · comments
Hi Ilya,
Been trying really hard to dump recordings using the sql and redis variation modules, to no avail.
Strangely enough I see only ONE record being inserted in my Postgres DB, whether using --use-getbulk
or not, even when adding --start-object
and --stop-object
flags or -getbulk-repetitions
.
It is not a DB connection problem as the printer table is created and with the right schema.
A regular snmpsim-record-commands with no variation modules gives me a correctly populated .snmprec
file.
The logs say there are no errors however the walk is extremely quick and as you can see I have a nice 0 oids dumped.
Here's the command I am using (recording against my local printer):
snmpsim-record-commands --agent-udpv4-endpoint=192.168.8.107 --start-object=1.3.6.1.2.1.1 --stop-object=1.3.6.1.2.1.9 --output-file=printer.snmprec --variation-module=sql --variation-module-options=dbtype:psycopg2,database:snmpsim,user:snmpsim,password:snmpsim,dbtable:printer --log-level=error --use-getbulk --getbulk-repetitions=30
Expected
printer.snmprec
to have the full dump- printer table in snmpsim db to be populated with the results.
Actual
- nothing in
printer.snmprec
- nothing in printer table
Regards from France, thanks for the terrific work on this tool ;) 🥇
Here's the output:
Scanning "/home/thomas/.snmpsim/variation" directory for variation modules...
Directory "/home/thomas/.snmpsim/variation" does not exist
Scanning "/home/thomas/snmp-project/venv/snmpsim/variation" directory for variation modules...
Variation module "sql" loaded
SNMP version 2c, Community name: public
Querying UDP/IPv4 agent at 192.168.8.107:161
Agent response timeout: 3 secs, retries: 3
Initializing variation module...
Variation module "sql" initialization OK
Sending initial GETBULK request for 1.3.6.1.2.1.1 (stop at 1.3.6.1.2.1.9)....
Shutting down variation module sql...
Variation module sql shutdown OK
OIDs dumped: 0, elapsed: 0.03 sec, rate: 0.00 OIDs/sec, errors: 0
FWIW, this appears to be a silent error in the variation/sql .record method - it's looking for a start oid entry in a dict, and the relevant entry appears to actually be called "args.start_object". Not yet clear whence the difference.
approx variation/sql.py:250