Extracting Software Inventory Information with SNMP
Problem
You want to use SNMP to retrieve software version information from the router.
Solution
From an NMS system, use the snmpwalk command:
aviva-server1% snmpwalk 192.168.15.1 public .1.3.6.1.2.1.25.6.3 … host.hrSWInstalled.hrSWInstalledTable.hrSWInstalledEntry.hrSWInstalledName.2 = "JUNOS Base OS Software Suite [7.4R1.7.0]" host.hrSWInstalled.hrSWInstalledTable.hrSWInstalledEntry.hrSWInstalledName.3 = "JUNOS Kernel Software Suite [7.4R1.7.0]" host.hrSWInstalled.hrSWInstalledTable.hrSWInstalledEntry.hrSWInstalledName.4 = "JUNOS Packet Forwarding Engine Support (M20/M40) [7.4R1.7.0]" host.hrSWInstalled.hrSWInstalledTable.hrSWInstalledEntry.hrSWInstalledName.5 = "JUNOS Routing Software Suite [7.4R1.7.0]" host.hrSWInstalled.hrSWInstalledTable.hrSWInstalledEntry.hrSWInstalledName.6 = "JUNOS Online Documentation [7.4R1.7.0]" host.hrSWInstalled.hrSWInstalledTable.hrSWInstalledEntry.hrSWInstalledName.7 = "JUNOS Crypto Software Suite [7.4R1.7.0]" host.hrSWInstalled.hrSWInstalledTable.hrSWInstalledEntry.hrSWInstalledName.9 = "JUNOS Support Tools Package [7.4R1.7.0]"
From the router, use the following equivalent command:
aviva@router1> show snmp mib walk .1.3.6.1.2.1.25.6.3 hrSWInstalledName.2 = JUNOS Base OS Software Suite [7.4R1.7.0] hrSWInstalledName.3 = JUNOS Kernel Software Suite [7.4R1.7.0] hrSWInstalledName.4 = JUNOS Packet Forwarding Engine Support (M20/M40) [7.4R1.7.0] hrSWInstalledName.5 = JUNOS Routing Software Suite [7.4R1.7.0] hrSWInstalledName.6 = JUNOS Online Documentation [7.4R1.7.0] hrSWInstalledName.7 = JUNOS Crypto Software Suite [7.4R1.7.0] hrSWInstalledName.9 = JUNOS Support Tools Package [7.4R1.7.0]
Discussion
The SNMP standard Host Resources MIB, specified in RFC 2790, contains objects that allow you to retrieve the versions of the software running on the router. The absolute path to the OID for installed software is .1.3.6.1.2.1.25.6.3. From the CLI, you get this same information with the show version command (see Recipe 1.25):
aviva@router1> show version Hostname: router1 Model: m20 JUNOS Base OS boot [7.4-20051024.0] JUNOS Base OS Software Suite [7.4-20051024.0] JUNOS Kernel Software Suite [7.4R1.7] JUNOS Packet Forwarding Engine Support (M20/M40) [7.4R1.7] JUNOS Routing Software Suite [7.4R1.7] JUNOS Online Documentation [7.4R1.7] JUNOS Crypto Software Suite [7.4R1.7]
In the SNMP output, the software version is shown as 7.42R1.7.0, which includes the instance (.0) of the software package.
See Also
Recipe 1.25