snmpget and compound MIB variables

Alexander Shikoff <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello All!

Juniper Networks provides handy MIBs for monitoring Source/Destination
Class Usage: JUNIPER-SCU-MIB and JUNIPER-DCU-MIB.
After issuing snmpwalk for Juniper router I got:

# snmpwalk -v2c -c public -m+JUNIPER-SCU-MIB -M+../mrtg/MIBs/Juniper/9.5 br1-gdr jnxScuStats
JUNIPER-SCU-MIB::jnxScuStatsPackets.208.ipv4."from-UAIX" = Counter64: 3874095450
JUNIPER-SCU-MIB::jnxScuStatsPackets.208.ipv4."from-World" = Counter64: 6761075110
JUNIPER-SCU-MIB::jnxScuStatsBytes.208.ipv4."from-UAIX" = Counter64: 323892864678
JUNIPER-SCU-MIB::jnxScuStatsBytes.208.ipv4."from-World" = Counter64: 554254412101
JUNIPER-SCU-MIB::jnxScuStatsClName.208.ipv4."from-UAIX" = STRING: from-UAIX
JUNIPER-SCU-MIB::jnxScuStatsClName.208.ipv4."from-World" = STRING: from-World

snmpget works fine also, for example when I want to get only one variable:
# snmpget -v2c -c public -m+JUNIPER-SCU-MIB -M+../mrtg/MIBs/Juniper/9.5 br1-gdr jnxScuStatsBytes.208.ipv4.\"from-World\"
JUNIPER-SCU-MIB::jnxScuStatsBytes.208.ipv4."from-World" = Counter64: 554258204428

The main problem is how to get the same behavior with Perl interface?
I've tried the following code:



#!/usr/bin/perl -w
use strict;
use SNMP;

$ENV{'MIBDIRS'} = '/usr/local/share/snmp/mibs:/data/noc/mrtg/MIBs/Juniper/9.5';
$ENV{'MIBS'} = 'JUNIPER-SCU-MIB';

my $sess = new SNMP::Session(DestHost => 'br1-gdr', Community => 'public', Version => '2c' );
print $sess->get('jnxScuStatsBytes.208.ipv4."from-World"'), "\n";



But script returns error NOSUCHINSTANCE.
Debugging shows that jnxScuStatsBytes.208.ipv4."from-World" is not
converted to OID correctly:
# ./test.pl
trace: netsnmp_ds_set_boolean(): default_store.c, 208:
netsnmp_ds_set_boolean: Setting LIB:4 = 0/False
trace: _snmp_build(): snmp_api.c, 2937:
snmp_send: Building SNMPv2 message...
trace: _snmp_build(): snmp_api.c, 2940:
dumph_send: GET
trace: snmp_pdu_realloc_rbuild(): snmp_api.c, 3308:
snmp_pdu_realloc_rbuild: starting
trace: snmp_pdu_realloc_rbuild(): snmp_api.c, 3323:
dumph_send:   VarBind
trace: snmp_realloc_rbuild_var_op(): snmp.c, 341:
dumph_send:     Value
dumpx_send:      05 00
dumpv_send:        NULL
trace: snmp_realloc_rbuild_var_op(): snmp.c, 442:
dumph_send:     Name
dumpx_send:      06 11 2B 06 01 04 01 94 4C 03 10 01 01 01 05 81
50 00 00
dumpv_send:        ObjID: jnxScuStatsBytes.208.0.0
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...]

Any help is kindly appreciated! Thanks.

-- 
MINO-RIPE

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.