Extracting Hardware Inventory Information with SNMP
Problem
You want to use SNMP to find out router hardware information and which field-replaceable units (FRUs) are present in the router.
Solution
If you are logged in to the router, you can get information using the show snmp mib commands. To get information about a single router component:
aviva@router1> show snmp mib get sysObjectID.0 sysObjectID.0 = jnxProductNameJ230M20
To get information about the next router component in the MIB:
aviva@router1> show snmp mib get jnxBoxClass.0 jnxBoxClass.0 = jnxProductLineM20.0 aviva@router1> show snmp mib get-next jnxBoxClass.0 jnxBoxDescr.0 = Juniper m20 Internet Backbone Router
For information about a number of router components, list each one separately:
aviva@router1> show snmp mib get "jnxBoxClass.0 jnxBoxClass.0" jnxBoxClass.0 = jnxProductLineM20.0 jnxBoxClass.0 = jnxProductLineM20.0
To get information about all the router components:
aviva@router1> show snmp mib walk jnxBoxAnatomy jnxBoxClass.0 = jnxProductLineM20.0 jnxBoxDescr.0 = Juniper m20 Internet Backbone Router jnxBoxSerialNo.0 = 25708 … jnxContainersType.1 = jnxChassisM20.0 jnxContainersType.2 = jnxM20SlotPower.0 jnxContainersType.4 = jnxM20SlotFan.0 jnxContainersType.6 = jnxM20SlotSSB.0 jnxContainersType.7 = jnxM20SlotFPC.0 jnxContainersType.8 = jnxM20MediaCardSpacePIC.0 jnxContainersType.9 = jnxM20SlotRE.0 jnxContainersType.10 = jnxM20SlotFrontPanel.0 jnxContainersDescr.1 = chassis frame jnxContainersDescr.2 = Power Supply slot jnxContainersDescr.4 = Fan slot jnxContainersDescr.6 = SSB slot jnxContainersDescr.7 = FPC slot jnxContainersDescr.8 = PIC slot jnxContainersDescr.9 = Routing Engine slot jnxContainersDescr.10 = Front Panel Display slot …
To get information about the FRUs, walk through the jnxContentsTable object:
aviva@router1> show snmp mib walk jnxContentsTable … jnxContentsType.1.1.0.0 = jnxBackplaneM20.0 jnxContentsType.2.1.0.0 = jnxM20Power.0 jnxContentsType.4.1.0.0 = jnxM20Fan.0 jnxContentsType.4.2.0.0 = jnxM20Fan.0 jnxContentsType.4.3.0.0 = jnxM20Fan.0 jnxContentsType.4.4.0.0 = jnxM20Fan.0 jnxContentsType.6.1.0.0 = jnxM20SSB.0 jnxContentsType.6.2.0.0 = jnxM20SSB.0 jnxContentsType.7.1.0.0 = jnxM20FPC.0 jnxContentsType.7.2.0.0 = jnxM20FPC.0 jnxContentsType.8.1.1.0 = jnxM20QuadEther.0 jnxContentsType.8.1.2.0 = jnxM20DualChDs3toDs0.0 jnxContentsType.8.1.3.0 = jnxM20QuadChT3.0 jnxContentsType.8.2.1.0 = jnxM20DualAtmOc3.0 jnxContentsType.9.1.0.0 = jnxM20RE.0 jnxContentsType.9.1.1.0 = jnxPCMCIACard.0 jnxContentsType.9.2.0.0 = jnxM20RE.0 jnxContentsType.9.2.1.0 = jnxPCMCIACard.0 jnxContentsType.10.1.0.0 = jnxM20FrontPanel.0
Discussion
In the Juniper Networks chassis MIB, router family information is in the jnxBoxAnatomy object and FRU information is in the jnxContentsTable object. On the router, you use the show snmp mib commands to collect data from these objects.
The three variations, show snmp mib get, show snmp mib get-next, and show snmp mib walk, are identical to the snmpget, snmpgetnext, and snmpwalk commands, respectively.
For the NMS system to extract this data, it needs to access the Juniper Networks chassis MIB to parse the MIB objects in the jnxBoxAnatomy and jnxContentsTable objects.
You can collect a range of information for each FRU. Here, we show data about the Routing Engine in slot 0:
aviva@router1> show snmp mib get jnxContentsType.9.1.0.0 jnxContentsType.9.1.0.0 = jnxM20RE.0 aviva@router1> show snmp mib get jnxContentsDescr.9.1.0.0 jnxContentsDescr.9.1.0.0 = Routing Engine 0 aviva@router1> show snmp mib get jnxContentsSerialNo.9.1.0.0 jnxContentsSerialNo.9.1.0.0 = 58000007348d9a01 aviva@router1> show snmp mib get jnxContentsRevision.9.1.0.0 jnxContentsRevision.9.1.0.0 = REV 06
If you are gathering hardware inventory information on the router, you use the show chassis hardware command (see Recipe 1.26):
aviva@router1> show chassis hardware Hardware inventory: Item Version Part number Serial number Description Chassis 25708 M20 Backplane REV 03 710-002334 BB9738 M20 Backplane Power Supply A REV 06 740-001465 005234 AC Power Supply Display REV 04 710-001519 BA4681 M20 FPM Board Routing Engine 0 REV 06 740-003239 1000224893 RE-2.0 Routing Engine 1 REV 06 740-003239 9000022146 RE-2.0 SSB slot 0 REV 02 710-001951 AZ8112 Internet Processor IIv1 SSB slot 1 N/A N/A N/A Backup FPC 0 REV 03 710-003308 BD8455 E-FPC PIC 0 REV 08 750-002303 AZ5310 4x F/E, 100 BASE-TX PIC 1 REV 07 750-004745 BC9368 2x CT3-NxDS0 PIC 2 REV 03 750-002965 HC9279 4x CT3 FPC 1 REV 03 710-003308 BB9032 E-FPC PIC 0 REV 03 750-002914 BC0131 2x OC-3 ATM, MM