Hello!
At the beginning,I wanna say that this letter is a little long,but easy to 
understand.
I wrote a MIB by imitating the NET-SNMP-TUTORIAL-MIB. And here is my MIB:
 
 
TEST-MIB DEFINITIONS ::= BEGIN
IMPORTS
 netSnmpExamples                FROM NET-SNMP-EXAMPLES-MIB
 ifIndex          FROM RFC1213-MIB   
 OBJECT-TYPE, Integer32,
        IpAddress,Counter64,enterprises,
 MODULE-IDENTITY                       FROM SNMPv2-SMI
 DisplayString, MacAddress, TruthValue FROM SNMPv2-TC;

    testMIB MODULE-IDENTITY
    LAST-UPDATED "200205290000Z"            -- 29 May 2002, midnight
    ORGANIZATION "net-snmp"
    CONTACT-INFO "postal:   Wes Hardaker
                            P.O. Box 382
                            Davis CA  95617
    email:    [email protected]
                 "
    DESCRIPTION  "A simple mib for demonstration purposes.
                 "
    ::= { netSnmpExamples 4 } 

aTestSetting               OBJECT IDENTIFIER ::= { testMIB 1 }
--*******************************************************************************************
tSetting  OBJECT IDENTIFIER ::= { aTestSetting 1 }        
                memoryUsage OBJECT-TYPE
                        SYNTAX DisplayString
                        MAX-ACCESS read-only
                        STATUS current
                        DESCRIPTION
                                "This attribute shall indicate the usage rate 
of Memory."
                        ::= { tSetting  1 }                                     
                              
                                                                                
                              
                cpuUsage OBJECT-TYPE
                        SYNTAX DisplayString
                        MAX-ACCESS read-only
                        STATUS current
                        DESCRIPTION
                                "This attribute shall indicate the usage rate 
of CPU."
                        ::= { tSetting  2 }     
END

 
After finishing the SNMP Agent extension ,I took the operation:
#snmpget -v 2c -c public localhost TEST-MIB::memoryUsage.0
and succeeded;
when I inputed:
#snmpget -v 2c -c public localhost TEST-MIB::cpuUsage.0
it said:
No Such Instance currently exists at this OID.
 
then I modified my MIB as below(deleted the leaf memeryUsage ):
 
TEST-MIB DEFINITIONS ::= BEGIN
IMPORTS
 netSnmpExamples                FROM NET-SNMP-EXAMPLES-MIB
 ifIndex          FROM RFC1213-MIB   
 OBJECT-TYPE, Integer32,
        IpAddress,Counter64,enterprises,
 MODULE-IDENTITY                       FROM SNMPv2-SMI
 DisplayString, MacAddress, TruthValue FROM SNMPv2-TC;

    testMIB MODULE-IDENTITY
    LAST-UPDATED "200205290000Z"            -- 29 May 2002, midnight
    ORGANIZATION "net-snmp"
    CONTACT-INFO "postal:   Wes Hardaker
                            P.O. Box 382
                            Davis CA  95617
    email:    [email protected]
                 "
    DESCRIPTION  "A simple mib for demonstration purposes.
                 "
    ::= { netSnmpExamples 4 } 

aTestSetting               OBJECT IDENTIFIER ::= { testMIB 1 }
    
--*******************************************************************************************
tSetting  OBJECT IDENTIFIER ::= { aTestSetting 1 }
                                                                                
                              
                cpuUsage OBJECT-TYPE
                        SYNTAX DisplayString
                        MAX-ACCESS read-only
                        STATUS current
                        DESCRIPTION
                                "This attribute shall indicate the usage rate 
of CPU."
                        ::= { tSetting  1 }
                                                                                
              
END

then I inputed:
#snmpget -v 2c -c public localhost TEST-MIB::cpuUsage.0
it succeed.
 
so, why did it fail before I deleted the "memoryUsage"?
How to make the two leaves exist at the same MIB together?
THANKS!!!






------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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

Reply via email to