Re: an additional number of oid in tutorial: NET-SNMP-TUTORIAL-MIB

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
2009/2/11 Alexander Bubnov <[email protected]>:
> Tutorial: http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent.
>
> Registration example from that tutorial:
>
>   void
> init_nstAgentSubagentObject(void)
> {
>   oid nstAgentSubagentObject_oid[] =
>   { 1, 3, 6, 1, 4, 1, 8072, 2, 4, 1, 1, 2, 0 };
>
> ...
> }
>
> notice above an additional number is 0 at the end of oid declaration. Let me
> know please why so?

This code is registering an *instance* of the (scalar) object
nstAgentSubagentObject.
(Note that the code used to register the OID is
"netsnmp_register_int_instance()"

If the object is registered as a full scalar object, then you'd omit the final 0
(and the registration would handle both valid and invalid instances).




> I can see declartion of nstAgentSubagentObject in mib without any additional
> numbers:
>
> nstAgentSubagentObject OBJECT-TYPE
                :
>   ::= { nstAgentModules 2 }

That is defining the MIB *object*.
The agent will always return the OID of an *instance* of this object.
For a scalar object, this involves adding an extra '0'.

See any SNMP book for more details.

Dave

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
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.