Search code examples
perlsnmpnet-snmp

Perl and SNMP - input options


script uses Net::SNMP module for Perl.

I'm trying to run snmpget command with some options added e.g. ( -Ir ) (here is list of options), but I haven't found any way to do that. In documentation for this module I didn't found anything about adding input options to snmp command.

If there is any other module that supports this, it would bi nice but it wouldn't be first pick as that would require a lot of changes in script (not mine script, just doing minor changes).

I could run system (or backticks) command from Perl, e.g.:

snmpget -v2c -c COMMUNITY -Ir HOST OID

and parse output but I would like to avoid that also.

Any advice or solution would be welcome since I'm still new to Perl.

Thx.


Solution

  • You linked to the documentation of Net::SNMP so I'm sure you've read it all before asking... Right?

    There is no "command", there is only your script's calls to the API.

    [Edit after the below comments]

    Net::SNMP has no option to check indexes before sending the request. So, you could say the equivalent of -Ir is enabled by default. In fact, Net::SNMP does not load your MIB, so it has no way of checking the validity of your requested variables before sending the request.