On Wed, Jun 11, 2014 at 8:10 AM,  <ganeshyell...@bel.co.in> wrote:
> Hi,
>
> I am usng net-snmp and I am developing mib browser in .Net framework
>
> How to distinguish whether an mib object is scalar or tabular?
>
> Is there any api function available in net-snmp for this?
>
> [In particular, when a user clicks on  sysDescr node of the the mib tree, it
> should add .0 at the end of the oid.
>
> whereas if user clicks on ifMtu node of the mib tree, it should only display
> the oid.]

When browsing a MIB (using getnext)  you would typically browse with the OID
of the variable  (for example: sysDescr is .1.3.6.1.2.1.1.1)

So when its retrieved... you get the 'actual' OID of the 'next' object.
So you'll see its OID and its index (which in the case of 'normally'
created scalars)
will be .0

If you browse a table... the index that's appended to each variables
OID will be...
whatever that table row's index is.  Normally a sequence of dot
separated numbers.
(not the simple '.0' as normal for a single scalar)

Having said that... I _have_ seen people (incorrectly?) use a table
index value of '.0'
and on the other hand, also seen scalars with indexes of something
_other_ than '.0'

So the only way to sort of tell if its a scalar or a table (in those
cases of bad sub-agents)
is to do a getnext on that variable you just fetched, and see if the
returned OID
has the same base OID (of the original scalar or table) or not.
[And/or read the MIB definition to see if its 'defined' as part of a
table; or not.]

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
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