Editing SNMP MIB Implementation

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 26: Line 26:
 
* mib2bin tool is modified from [http://net-snmp.sourceforge.net/ net-snmp] to convert ASN.1 format file to four files, because the microchip '''mib2bib''' converter only supports upto 255 OIDs.
 
* mib2bin tool is modified from [http://net-snmp.sourceforge.net/ net-snmp] to convert ASN.1 format file to four files, because the microchip '''mib2bib''' converter only supports upto 255 OIDs.
 
                                 MIB compiler tools: '''mib2bin'''
 
                                 MIB compiler tools: '''mib2bin'''
   [http://www.modtronix.com/products/sbc44ec/00870a.pdf foo.mib] (ANS.1 format)  -----------------------------------> foo.bin + foo_trap.bin + foo.h + foo_data.h
+
   [http://www.modtronix.com/products/sbc44ec/00870a.pdf foo.mib] (ANS.1 format)  -----------------------------------> foo.bin + foo_trap.bin + foo.h + foo_data.h
  
 
* Syntax to use mib2bin tool:
 
* Syntax to use mib2bin tool:
   '''mib2bin <MIBfile>...
+
   '''mib2bin &lt;MIBfile&gt;...
* where MIBfile file is ASN.1 format file. MIBfile = <name>.<type>
+
* where MIBfile file is ASN.1 format file. MIBfile = &lt;name&gt;.&lt;type&gt;
** '''<name>.bin''' is the binary file storing information of OID tree. This file can be placed on an SD media card to be read by the FAT32 file system.
+
** '''&lt;name&gt;.bin''' is the binary file storing information of OID tree. This file can be placed on an SD media card to be read by the FAT32 file system.
** '''<name>_trap.bin''' is the binary file storing information of TRAP of MIB. This file can be placed on an SD media card to be read by the FAT32 file system.
+
** '''&lt;name&gt;_trap.bin''' is the binary file storing information of TRAP of MIB. This file can be placed on an SD media card to be read by the FAT32 file system.
** '''<name>_data.h''' is C header file storing information of OID tree.  This file is generated by converting mchip.bin file to the C header file. It's only used when a system don't have system file and place on program memory.
+
** '''&lt;name&gt;_data.h''' is C header file storing information of OID tree.  This file is generated by converting mchip.bin file to the C header file. It's only used when a system don't have system file and place on program memory.
** '''<name>.h''' is C header file storing ID that's reference to function service of OID.
+
** '''&lt;name&gt;.h''' is C header file storing ID that's reference to function service of OID.
 
* Note:  
 
* Note:  
 
** Subfolder '''mibs''' containing the basics MIB files (e.g.: RFC1155-SMI, RFC1213-MIB, RFC-1215, SNMPv2-MIB ... for us MIB file), must be present under the directory of execution.
 
** Subfolder '''mibs''' containing the basics MIB files (e.g.: RFC1155-SMI, RFC1213-MIB, RFC-1215, SNMPv2-MIB ... for us MIB file), must be present under the directory of execution.
 
** If the four files exist, mib2bin tool will overwrite the files.
 
** If the four files exist, mib2bin tool will overwrite the files.
  
===Binary File Format <name>.bin===
+
===Binary File Format &lt;name&gt;.bin===
 
* The binary file is an image of MIB file. It is generated by mib2bin tool. Agents will read binary file to respond NMS request.
 
* The binary file is an image of MIB file. It is generated by mib2bin tool. Agents will read binary file to respond NMS request.
 
* In the binary file, A parent is stored first, followed by its first-child to last-child. Next, the structure of next this parent is stored. This structure is repeated until the entire tree is stored.
 
* In the binary file, A parent is stored first, followed by its first-child to last-child. Next, the structure of next this parent is stored. This structure is repeated until the entire tree is stored.
 
* A parent or child is a record. Single record of binary file have format:
 
* A parent or child is a record. Single record of binary file have format:
   <oid>, <nodeInfo>,  
+
   &lt;oid&gt;, &lt;nodeInfo&gt;,  
 
   [id], [siblingOffset]/[distantSiblingOffset], [dataType], [dataLen], [data],  
 
   [id], [siblingOffset]/[distantSiblingOffset], [dataType], [dataLen], [data],  
   [{<IndexNumber>}, {<IndexCount>, <IndexNodeInfo>, <IndexDataType>} ...]
+
   [{&lt;IndexNumber&gt;}, {&lt;IndexCount&gt;, &lt;IndexNodeInfo&gt;, &lt;IndexDataType&gt;} ...]
 
* where:
 
* where:
** fields indicated by angle brackets (< >) are always present
+
** fields indicated by angle brackets (&lt; &gt;) are always present
 
** fields in square brackets ([ ]) are optional depending on characteristics of the current node.
 
** fields in square brackets ([ ]) are optional depending on characteristics of the current node.
 
** fields in braces ({ }) are optional but always occur together.
 
** fields in braces ({ }) are optional but always occur together.
  
====<oid> field====
+
====&lt;oid&gt; field====
 
* The microchip format only supports OIDs upto 255. The following is an workaround to store OID greater than 255.
 
* The microchip format only supports OIDs upto 255. The following is an workaround to store OID greater than 255.
 
* Format of OID:
 
* Format of OID:
Line 67: Line 67:
 
     The OID = 36061 is decoded by 0x02*0x80*0x80 + 0x19*0x80 + 0x5D
 
     The OID = 36061 is decoded by 0x02*0x80*0x80 + 0x19*0x80 + 0x5D
  
====<nodeInfo> field====
+
====&lt;nodeInfo&gt; field====
 
* information of node
 
* information of node
 
   bit        when (set = 1)
 
   bit        when (set = 1)
Line 115: Line 115:
 
** [data] is data on string.
 
** [data] is data on string.
  
====[{<IndexNumber>}] and [{<IndexCount>, <IndexNodeInfo>, <IndexDataType>}] fields====
+
====[{&lt;IndexNumber&gt;}] and [{&lt;IndexCount&gt;, &lt;IndexNodeInfo&gt;, &lt;IndexDataType&gt;}] fields====
 
* If this record is sequence (an order list of objects),  
 
* If this record is sequence (an order list of objects),  
** <IndexNumber> is the number of INDEXes in sequence.
+
** &lt;IndexNumber&gt; is the number of INDEXes in sequence.
** <IndexCount>: is id of index node in table
+
** &lt;IndexCount&gt;: is id of index node in table
** <IndexNodeInfo>: is info of index node
+
** &lt;IndexNodeInfo&gt;: is info of index node
** <IndexDataType>: is data type of index node
+
** &lt;IndexDataType&gt;: is data type of index node
 
* See [http://www.simpleweb.org/w/images/9/91/Tutorial_Slides_Smi.pdf example] of accessing data in a table
 
* See [http://www.simpleweb.org/w/images/9/91/Tutorial_Slides_Smi.pdf example] of accessing data in a table
 
* Example:  
 
* Example:  
 
** '''trap''' node is a sequence to inform the NMS of a significant event (an extraordinary event has occurred at an agent) asynchronously. This sequence has two INDEXes, so we have:
 
** '''trap''' node is a sequence to inform the NMS of a significant event (an extraordinary event has occurred at an agent) asynchronously. This sequence has two INDEXes, so we have:
       <IndexNumber> = 0x02
+
       &lt;IndexNumber&gt; = 0x02
 
       with the 1st INDEX:
 
       with the 1st INDEX:
           <IndexCount> = 0x05
+
           &lt;IndexCount&gt; = 0x05
           <IndexNodeInfo> = 0x28
+
           &lt;IndexNodeInfo&gt; = 0x28
           <IndexDataType> = 0x02
+
           &lt;IndexDataType&gt; = 0x02
 
       with the 2nd INDEX:
 
       with the 2nd INDEX:
           <IndexCount> = 0x08
+
           &lt;IndexCount&gt; = 0x08
           <IndexNodeInfo> = 0xA4
+
           &lt;IndexNodeInfo&gt; = 0xA4
           <IndexDataType> = 0x04
+
           &lt;IndexDataType&gt; = 0x04
 
   In this example, '''trap''' is a table which has 4 columns:  
 
   In this example, '''trap''' is a table which has 4 columns:  
       <font color=blue>trapReceiverNumber (1)</font>, trapEnabled (2), trapReceiverIPAddress (3), <font color=blue>trapCommunity(4)</font>.  
+
       &lt;font color=blue&gt;trapReceiverNumber (1)&lt;/font&gt;, trapEnabled (2), trapReceiverIPAddress (3), &lt;font color=blue&gt;trapCommunity(4)&lt;/font&gt;.  
       <font color=blue>trapReceiverNumber (1)</font>, trapEnabled (2), trapReceiverIPAddress (3), <font color=blue>trapCommunity(4)</font>.  
+
       &lt;font color=blue&gt;trapReceiverNumber (1)&lt;/font&gt;, trapEnabled (2), trapReceiverIPAddress (3), &lt;font color=blue&gt;trapCommunity(4)&lt;/font&gt;.  
       <font color=blue>trapReceiverNumber (1)</font>, trapEnabled (2), trapReceiverIPAddress (3), <font color=blue>trapCommunity(4)</font>.  
+
       &lt;font color=blue&gt;trapReceiverNumber (1)&lt;/font&gt;, trapEnabled (2), trapReceiverIPAddress (3), &lt;font color=blue&gt;trapCommunity(4)&lt;/font&gt;.  
 
   Each significant event will be a row defined in the '''trap''' table.  
 
   Each significant event will be a row defined in the '''trap''' table.  
 
    
 
    
Line 150: Line 150:
 
           IndexDataType = 0x04
 
           IndexDataType = 0x04
  
===Binary File Format <name>_trap.bin===
+
===Binary File Format &lt;name&gt;_trap.bin===
 
* The binary file store TRAP information. It is generated by mib2bin tool. Agents will read binary file to get information of TRAP when something bad occurs.
 
* The binary file store TRAP information. It is generated by mib2bin tool. Agents will read binary file to get information of TRAP when something bad occurs.
* In the binary file, An enterprise OID is stored first, followed by its first specific trap number and IDs of first specific trap (those IDs matche with IDs of leaf in <name>.bin; IDs are reference to OIDs of data bindings that be included in this trap) to last specific trap number and IDs of last specific trap. Next, the structure of next this enterprise OID is stored. This structure is repeated until all enterprise OID in MIB file is stored.
+
* In the binary file, An enterprise OID is stored first, followed by its first specific trap number and IDs of first specific trap (those IDs matche with IDs of leaf in &lt;name&gt;.bin; IDs are reference to OIDs of data bindings that be included in this trap) to last specific trap number and IDs of last specific trap. Next, the structure of next this enterprise OID is stored. This structure is repeated until all enterprise OID in MIB file is stored.
* The format of enterprise in <name>_trap.bin
+
* The format of enterprise in &lt;name&gt;_trap.bin
   <enterprise_oid><sibling_enterprise><enterprise_index>[specific_trap_number][sibling_specific_trap][number_varbinds][id_varbind]...
+
   &lt;enterprise_oid&gt;&lt;sibling_enterprise&gt;&lt;enterprise_index&gt;[specific_trap_number][sibling_specific_trap][number_varbinds][id_varbind]...
 
* where:
 
* where:
** fields indicated by angle brackets (< >) are always present.
+
** fields indicated by angle brackets (&lt; &gt;) are always present.
 
** fields in square brackets ([ ]) are optional depending on characteristics of the trap.
 
** fields in square brackets ([ ]) are optional depending on characteristics of the trap.
  
====<enterprise_oid> field====
+
====&lt;enterprise_oid&gt; field====
 
* Enterprise oid is full oid of enterprise trap that want to send in MIB file.
 
* Enterprise oid is full oid of enterprise trap that want to send in MIB file.
 
* The format of enterprise oid.  
 
* The format of enterprise oid.  
   <sub_oid> <info_sub_oid> ...  
+
   &lt;sub_oid&gt; &lt;info_sub_oid&gt; ...  
 
* where:
 
* where:
**  <font color=red><sub_oid>:</font> is same format of <oid> field in MIB file.
+
**  &lt;font color=red&gt;&lt;sub_oid&gt;:&lt;/font&gt; is same format of &lt;oid&gt; field in MIB file.
**  <font color=red><info_sub_oid>:</font> Information of sub_oid.
+
**  &lt;font color=red&gt;&lt;info_sub_oid&gt;:&lt;/font&gt; Information of sub_oid.
   <info_sub_oid> format:
+
   &lt;info_sub_oid&gt; format:
 
       bit        when (set = 1)
 
       bit        when (set = 1)
 
       0          the first sub_oid in enterprise
 
       0          the first sub_oid in enterprise
Line 176: Line 176:
 
       6          no use
 
       6          no use
 
       7          the last sub_oid in enterprise
 
       7          the last sub_oid in enterprise
* If <sub_oid> == BYTE (0x00) and <info_sub_oid> == BYTE(0xFF), this is the end of infomation traps.
+
* If &lt;sub_oid&gt; == BYTE (0x00) and &lt;info_sub_oid&gt; == BYTE(0xFF), this is the end of infomation traps.
  
====<sibling_enterprise> field====
+
====&lt;sibling_enterprise&gt; field====
 
* Point to next enterprise OID.
 
* Point to next enterprise OID.
 
* In little-endian format.
 
* In little-endian format.
====<enterprise_index> field====
+
====&lt;enterprise_index&gt; field====
* Index of enterprise OID traps in <name>_trap.bin file.
+
* Index of enterprise OID traps in &lt;name&gt;_trap.bin file.
* Size of <enterprise_index> is 1 byte.
+
* Size of &lt;enterprise_index&gt; is 1 byte.
 
====[specific_trap_number] field====
 
====[specific_trap_number] field====
 
* If the trap is sent is specific trap, specific trap number is a number indicting specific trap.
 
* If the trap is sent is specific trap, specific trap number is a number indicting specific trap.
Line 195: Line 195:
 
====[id_varbind] field====
 
====[id_varbind] field====
 
* [id_varbind] define data bindings (OID and value of OID leaf) that is included specific trap.
 
* [id_varbind] define data bindings (OID and value of OID leaf) that is included specific trap.
* [id_varbind] is reference to id of the leaf oid in <name>.bin.
+
* [id_varbind] is reference to id of the leaf oid in &lt;name&gt;.bin.
 
* In little-endian format.
 
* In little-endian format.
  
Line 204: Line 204:
 
[[File:Snmp mib oid tree example.jpg | thumb | center | 900px]]
 
[[File:Snmp mib oid tree example.jpg | thumb | center | 900px]]
  
====Binary File <name>.bin====
+
====Binary File &lt;name&gt;.bin====
* The corresponding binary file is <name>.bin and it has data describe in  table below:
+
* The corresponding binary file is &lt;name&gt;.bin and it has data describe in  table below:
** '''oid''' is <oid> fields.
+
** '''oid''' is &lt;oid&gt; fields.
** '''info''' is <nodeInfo> fields.
+
** '''info''' is &lt;nodeInfo&gt; fields.
 
** '''dist''' is [distantSiblingOffset]/[siblingOffset] fields.
 
** '''dist''' is [distantSiblingOffset]/[siblingOffset] fields.
 
** '''id''' is [id] fields.
 
** '''id''' is [id] fields.
 
** '''type''' is [dataType] fields.
 
** '''type''' is [dataType] fields.
** '''index''' is index fields of sequence, include [{index_number} , {<IndexCount>, <IndexNodeInfo>, <indexDataType>, ...}].
+
** '''index''' is index fields of sequence, include [{index_number} , {&lt;IndexCount&gt;, &lt;IndexNodeInfo&gt;, &lt;indexDataType&gt;, ...}].
  
 
[[File:Snmp mib binary example.jpg | thumb | center | 900px]]
 
[[File:Snmp mib binary example.jpg | thumb | center | 900px]]
  
* The detail description of <name>.bin is illustrated in the diagram below:
+
* The detail description of &lt;name&gt;.bin is illustrated in the diagram below:
 
** The black arrow lines represent the OID tree structure.
 
** The black arrow lines represent the OID tree structure.
 
** The red and green lines represent pointers to data.
 
** The red and green lines represent pointers to data.
Line 221: Line 221:
 
[[File:Snmp mib binary detail example.jpg | thumb | center | 900px]]
 
[[File:Snmp mib binary detail example.jpg | thumb | center | 900px]]
  
====Binary File <name>_trap.bin====
+
====Binary File &lt;name&gt;_trap.bin====
* The corresponding binary file is <name>_trap.bin and it has data describe in  table below:
+
* The corresponding binary file is &lt;name&gt;_trap.bin and it has data describe in  table below:
** '''enterp''' is <enterprise_oid> fields.
+
** '''enterp''' is &lt;enterprise_oid&gt; fields.
** '''sibl_ep''' is <sibling_enterprise> fields.
+
** '''sibl_ep''' is &lt;sibling_enterprise&gt; fields.
** '''index_ep''' is <enterprise_index> fields.
+
** '''index_ep''' is &lt;enterprise_index&gt; fields.
 
** '''spec_id''' is [specific_trap_number] fields.
 
** '''spec_id''' is [specific_trap_number] fields.
 
** '''sibl_sid''' is [sibling_specific_trap] fields.
 
** '''sibl_sid''' is [sibling_specific_trap] fields.
Line 243: Line 243:
 
** ASN.1 complex data types are used to build SNMP message are Sequence type, Sequence-of type.
 
** ASN.1 complex data types are used to build SNMP message are Sequence type, Sequence-of type.
  
===[http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&url=http%3A%2F%2Fwww.itu.int%2FITU-T%2Fstudygroups%2Fcom17%2Flanguages%2FX.690-0207.pdf&rct=j&q=x.690-0207&ei=cde_TcrvJouMvQOm5-jABA&usg=AFQjCNGYmD4USBwcWoeHoRFZ3zdP39kosw&cad=rja=Basic Encoding Rules (BER)]===
+
===[http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBgQFjAA&amp;url=http%3A%2F%2Fwww.itu.int%2FITU-T%2Fstudygroups%2Fcom17%2Flanguages%2FX.690-0207.pdf&amp;rct=j&amp;q=x.690-0207&amp;ei=cde_TcrvJouMvQOm5-jABA&amp;usg=AFQjCNGYmD4USBwcWoeHoRFZ3zdP39kosw&amp;cad=rja=Basic Encoding Rules (BER)]===
 
* BER has three parts: Type, Length and Data field.
 
* BER has three parts: Type, Length and Data field.
 
   BER format:  
 
   BER format:  
Line 330: Line 330:
 
       |      |                |  (Integer)  |    (Octet String)    |          |
 
       |      |                |  (Integer)  |    (Octet String)    |          |
 
       +------+----------------+-------------+-----------------------+----------+
 
       +------+----------------+-------------+-----------------------+----------+
                               |<--------------------Length-------------------->|
+
                               |&lt;--------------------Length--------------------&gt;|
 
* Length is bytes of Data field (SNMP Version, SNMP Community String and SNMP PDU).
 
* Length is bytes of Data field (SNMP Version, SNMP Community String and SNMP PDU).
 
* SNMP Version is an integer that identifies the version of SNMP, SNMP version 1 = 0.
 
* SNMP Version is an integer that identifies the version of SNMP, SNMP version 1 = 0.
Line 353: Line 353:
 
   |      |        |        |        |        |      |        | 0x30 | Len 1 | OID 1 | Value 1 | 0x30 | Len 2 | OID 1 | Value 2 | ... |
 
   |      |        |        |        |        |      |        | 0x30 | Len 1 | OID 1 | Value 1 | 0x30 | Len 2 | OID 1 | Value 2 | ... |
 
   +------+--------+---------+---------+---------+------+--------+------+-------+-------+---------+------+-------+-------+---------+-----+
 
   +------+--------+---------+---------+---------+------+--------+------+-------+-------+---------+------+-------+-------+---------+-----+
                   |                                            |              |<-----Len 1----->|              |<-----Len 2----->|    |
+
                   |                                            |              |&lt;-----Len 1-----&gt;|              |&lt;-----Len 2-----&gt;|    |
                   |                                            |<-------------------------------Length-------------------------------->|
+
                   |                                            |&lt;-------------------------------Length--------------------------------&gt;|
                   |<----------------------------------------------Lenght PDU----------------------------------------------------------->|  
+
                   |&lt;----------------------------------------------Lenght PDU-----------------------------------------------------------&gt;|  
 
* PDU Type is specific type of PDU, PDU Type is a single byte identifier.
 
* PDU Type is specific type of PDU, PDU Type is a single byte identifier.
 
* Length Data is a number bytes of Data of SNMP PDU field.
 
* Length Data is a number bytes of Data of SNMP PDU field.
Line 377: Line 377:
 
* Varbind List is a Sequence of Varbinds.
 
* Varbind List is a Sequence of Varbinds.
 
** Varbind is a Sequence of two fields, an OID and the value of OID.
 
** Varbind is a Sequence of two fields, an OID and the value of OID.
*** OID is an Object Identifier that points to a particular parameter in the SNMP agent. The first two object identifier components in the object identifier value being encoded, using the formula: <font color=red>(X*40) + Y</font>; where X is the value of the first object identifier component and Y is the value of the second object identifier component. The first two object identifier components recognizes that only three values are allocated from the root node, and at most 39 subsequent values from nodes reached by X = 0 and X = 1.
+
*** OID is an Object Identifier that points to a particular parameter in the SNMP agent. The first two object identifier components in the object identifier value being encoded, using the formula: &lt;font color=red&gt;(X*40) + Y&lt;/font&gt;; where X is the value of the first <span class="plainlinks">[http://www.thepiggybackrider.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;/*CITATION*/">kid carrier</span>]</span> object identifier component and Y is the value of the second object identifier component. The first two object identifier components recognizes that only three values are allocated from the root node, and at most 39 subsequent values from nodes reached by X = 0 and X = 1.
 
*** Value is the value of OID.
 
*** Value is the value of OID.
 
   +--------------------+-----------------------------------------------------------------+
 
   +--------------------+-----------------------------------------------------------------+
Line 402: Line 402:
 
   |    |      |          |      |      |        |      |      |        |0x30| Len 1 | OID 1 | Value 1 |0x30| Len 2 | OID 1 | Value 2 | ... |
 
   |    |      |          |      |      |        |      |      |        |0x30| Len 1 | OID 1 | Value 1 |0x30| Len 2 | OID 1 | Value 2 | ... |
 
   +----+------+----------+-------+-------+--------+------+------+--------+----+-------+-------+---------+----+-------+-------+---------+-----+
 
   +----+------+----------+-------+-------+--------+------+------+--------+----+-------+-------+---------+----+-------+-------+---------+-----+
                           |                                              |            |<-----Len 1----->|            |<-----Len 2----->|    |
+
                           |                                              |            |&lt;-----Len 1-----&gt;|            |&lt;-----Len 2-----&gt;|    |
                           |                                              |<-----------------------------Length------------------------------>|
+
                           |                                              |&lt;-----------------------------Length------------------------------&gt;|
                           |<--------------------------------------------Lenght PDU----------------------------------------------------------->|
+
                           |&lt;--------------------------------------------Lenght PDU-----------------------------------------------------------&gt;|
 
* PDU type is TRAP PDU = 0xA4.
 
* PDU type is TRAP PDU = 0xA4.
 
* Length Data is a number bytes of Data of SNMP PDU field.  
 
* Length Data is a number bytes of Data of SNMP PDU field.  
Line 442: Line 442:
 
* Time stamp is the time elapsed between the last initialization of the network entity and the generation of the trap.
 
* Time stamp is the time elapsed between the last initialization of the network entity and the generation of the trap.
 
* Varbind List is a Sequence of Varbinds to be included in the trap.
 
* Varbind List is a Sequence of Varbinds to be included in the trap.
** Varbind is a Sequence of two fields, an OID and the value of OID. The OIDs for these variable bindings are often specific to the trap and therefore "underneath" the specific OID for the trap. But this isn't a requirement, and it's often useful to send bindings that aren't defined as part of the trap.  
+
** Varbind is a Sequence of two fields, an OID and the value of OID. The OIDs for these variable bindings are often specific to the trap and therefore &quot;underneath&quot; the specific OID for the trap. But this isn't a requirement, and it's often useful to send bindings that aren't defined as part of the trap.  
 
*** OID is an Object Identifier that points to a particular parameter in the SNMP agent.
 
*** OID is an Object Identifier that points to a particular parameter in the SNMP agent.
 
*** Value is the value of OID
 
*** Value is the value of OID
Line 449: Line 449:
 
====GetRequest PDU====
 
====GetRequest PDU====
 
* The example gets the value of name agent with above MIB file.
 
* The example gets the value of name agent with above MIB file.
* Community String is "public"
+
* Community String is &quot;public&quot;
 
   +---------+-----------+--------------------------------------------------------------------------------------------+-------------------+
 
   +---------+-----------+--------------------------------------------------------------------------------------------+-------------------+
 
   | SNMP    | Type      |                                              0x30                                        | Sequence          |
 
   | SNMP    | Type      |                                              0x30                                        | Sequence          |
Line 496: Line 496:
 
====TRAP PDU====
 
====TRAP PDU====
 
* The example TRAP above MIB file.
 
* The example TRAP above MIB file.
* Community String is "public"
+
* Community String is &quot;public&quot;
 
* Agent's IPAddress is 192.168.1.128
 
* Agent's IPAddress is 192.168.1.128
 
* Timestamp is 123456
 
* Timestamp is 123456
Line 560: Line 560:
 
* Example SNMP operations with net-snmp:
 
* Example SNMP operations with net-snmp:
 
   '''GetRequest command:'''
 
   '''GetRequest command:'''
   >> snmpget -v 1 -c public 192.168.1.128 1.3.6.1.4.1.36061.1.1
+
   &gt;&gt; snmpget -v 1 -c public 192.168.1.128 1.3.6.1.4.1.36061.1.1
 
   This command will send GetRequest to the agent (IP address of agent is 192.186.1.128). The SNMP is SNMPv1 (the option ''-v 1'') with community  
 
   This command will send GetRequest to the agent (IP address of agent is 192.186.1.128). The SNMP is SNMPv1 (the option ''-v 1'') with community  
 
   string is public (the option ''-c public''). In above demo MIB file, 1.3.6.1.4.1.36061.1.1 is OID reference to devID object.  
 
   string is public (the option ''-c public''). In above demo MIB file, 1.3.6.1.4.1.36061.1.1 is OID reference to devID object.  
 
   The effect of this command will get the value of agent's devID .
 
   The effect of this command will get the value of agent's devID .
 
   '''GetNextRequest command:'''
 
   '''GetNextRequest command:'''
   >> snmpgetnext -v 1 -c public 192.168.1.128 1.3.6.1.4.1.36061.1
+
   &gt;&gt; snmpgetnext -v 1 -c public 192.168.1.128 1.3.6.1.4.1.36061.1
 
   This command will send GetNextRequest to the agent (IP address of agent is 192.186.1.128). The SNMP is SNMPv1 (the option ''-v 1'') with community  
 
   This command will send GetNextRequest to the agent (IP address of agent is 192.186.1.128). The SNMP is SNMPv1 (the option ''-v 1'') with community  
 
   string is public (the option ''-c public''). In above demo MIB file, 1.3.6.1.4.1.36061.1 is OID.
 
   string is public (the option ''-c public''). In above demo MIB file, 1.3.6.1.4.1.36061.1 is OID.
 
   The effect of this command will get the value of agent's devID.
 
   The effect of this command will get the value of agent's devID.
 
   '''SetRequest command:'''
 
   '''SetRequest command:'''
   >> snmpset -v 1 -c public 192.168.1.128 1.3.6.1.4.1.36061.1.1 s "Hello"
+
   &gt;&gt; snmpset -v 1 -c public 192.168.1.128 1.3.6.1.4.1.36061.1.1 s &quot;Hello&quot;
 
   This command will send SetRequest to the agent (IP address of agent is 192.186.1.128). The SNMP is SNMPv1 (the option ''-v 1'') with community  
 
   This command will send SetRequest to the agent (IP address of agent is 192.186.1.128). The SNMP is SNMPv1 (the option ''-v 1'') with community  
 
   string is public (the option ''-c public''). In above demo MIB file, 1.3.6.1.4.1.36061.1.1 is OID reference to devID object.  
 
   string is public (the option ''-c public''). In above demo MIB file, 1.3.6.1.4.1.36061.1.1 is OID reference to devID object.  
   The effect of this command will set the value of agent's devID to "Hello".
+
   The effect of this command will set the value of agent's devID to &quot;Hello&quot;.
 
   '''Receiving Traps'''
 
   '''Receiving Traps'''
 
   To receive Traps, snmptrapd.conf file must be configured and snmptrapd must be running.
 
   To receive Traps, snmptrapd.conf file must be configured and snmptrapd must be running.
Line 579: Line 579:
 
       disableAuthorization yes
 
       disableAuthorization yes
 
   The following command will receive and view trap
 
   The following command will receive and view trap
   >>snmptrapd -f -Le
+
   &gt;&gt;snmptrapd -f -Le

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)