I'm developing an application and I need to retrive each ifPhysAddress field
using the perl module.
I'm running on ubuntu-festy and using Net-SNMP-5.2.3 (but I also tried with
Gentoo using 5.4).

Querying by snmpget/walk is ok:
Example:
#####
$>  snmpwalk -c public -v 2c 192.168.5.100 ifPhysAddress.8
IF-MIB::ifPhysAddress.8 = STRING: 0:14:bf:d2:67:e5


but trying with perl gives this...

THE PERL SCRIPT:
###########
#!/usr/bin/perl
use strict;
use warnings;
use SNMP;

my $s = new SNMP::Session (DestHost => "192.168.5.100", Version=>"2c");
print ($s->get('ifPhysAddress.8'));
########
THE OUTPUT:  "��g"

I must solve this problem absolutely! Please help me!
I tried converting the output with the "hex" command but it didn't seemed to
work.
If Could be usefull these are the last lines i get enabling the debugmode:
(adding $SNMP::debugging = 2; to the script above)
###############
trace: snmp_comstr_parse(): snmp_auth.c, 135:
dumph_recv:   SNMP version
dumpx_recv:    02 01 01
dumpv_recv:      Integer:       1 (0x01)
trace: snmp_comstr_parse(): snmp_auth.c, 147:
dumph_recv:   community string
dumpx_recv:    04 06 70 75 62 6C 69 63
dumpv_recv:      String:        public
trace: _snmp_parse(): snmp_api.c, 4139:
dumph_recv:   PDU
trace: snmp_pdu_parse(): snmp_api.c, 4245:
dumpv_recv:     Command RESPONSE
trace: snmp_pdu_parse(): snmp_api.c, 4326:
dumph_recv:     request_id
dumpx_recv:      02 04 75 0F 42 6A
dumpv_recv:        Integer:     1963934314 (0x750F426A)
trace: snmp_pdu_parse(): snmp_api.c, 4337:
dumph_recv:     error status
dumpx_recv:      02 01 00
dumpv_recv:        Integer:     0 (0x00)
trace: snmp_pdu_parse(): snmp_api.c, 4348:
dumph_recv:     error index
dumpx_recv:      02 01 00
dumpv_recv:        Integer:     0 (0x00)
trace: snmp_pdu_parse(): snmp_api.c, 4366:
dumph_recv:     VarBindList
trace: snmp_pdu_parse(): snmp_api.c, 4396:
dumph_recv:       VarBind
trace: snmp_parse_var_op(): snmp.c, 166:
dumph_recv:         Name
dumpx_recv:          06 0A 2B 06 01 02 01 02 02 01 06 08
dumpv_recv:            ObjID: ifPhysAddress.8
trace: snmp_pdu_parse(): snmp_api.c, 4405:
dumph_recv:         Value
dumpx_recv:          04 06 00 14 BF D2 67 E5
dumpv_recv:            String:  ....g.
trace: netsnmp_ds_set_int(): default_store.c, 257:
netsnmp_ds_set_int: Setting LIB:4 = 1
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to