Posted on 2009-01-04 03:48:49-08 by n0wh3r3man
SNMP Object Types
I am reading from a file of VARBINDS such as
procCrash,6,1,1.3.6.1.4.1.17163.1.1.2.5.1.2,OCTET_STRING,sport
I know I must be having brain freeze.. But why doesn't the below excerpt work ?
$oid = '1.3.6.1.4.1.17163.1.1.2.5.1.2'; $objtype = 'OCTET_STRING'; $process = 'sport'; .... -varbindlist => [$oid, $objtype, $process]
but this
-varbindlist => [$oid, OCTET_STRING, $process]
does.
Direct Responses: 9642 | Write a response
Posted on 2009-01-04 17:11:34-08 by dtown in response to 9641
Re: SNMP Object Types
The ASN.1 type "names" are exported as functions, not strings, by the Net::SNMP module. The functions return a numeric value representing the type. In your example you are passing a string to the "-varbindlist" when it expects a numeric value. What you need to do is execute the function named "OCTET_STRING" by doing something like:
$type = 'OCTET_STRING'; $objtype = &{$type}();
Direct Responses: 9643 | Write a response
Posted on 2009-01-04 21:24:36-08 by n0wh3r3man in response to 9642
Re: SNMP Object Types
Excellent ! That did the trick.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.