Reputation: 29
I want write SNMP inventory program. I know how to retrieve MIB strings, but I don't know how to find the device model. I want to be able to find the model of devices such as Cisco 2920 switches.
Thanks
Upvotes: 2
Views: 23669
Reputation: 364
her is the OID you want: entPhysicalModelName
.1.3.6.1.2.1.47.1.1.1.1.13.1
Upvotes: 0
Reputation: 1635
On Cisco devices, the model type can be generally by found by polling the system.sysDescr.0
OID. This can be obtained by running the following command:
snmpwalk -v 2c -c <InsertCommunityStringHere> <DeviceIPAddress> system.sysDescr.0
The specific OID, here would be either .iso.org.dod.internet.mgmt.mib-2.system.sysDescr
or 1.3.6.1.2.1.1.1
and then parsing out the desired field as you see fit (Perl, bash, etc.)
If you have other vendor devices to poll, I would recommend starting out by manually running an snmpwalk -v 2c -c <InsertCommunityStringHere> <DeviceIPAddress> system
to get a general idea of how the various devices respond and help you identify the proper fields you are interested in using for your application. Below is a sample output from a Cisco 2900 switch.
Upvotes: 1
Reputation: 133
Both are working:
$ snmpwalk -v 2c -c ssss 195.149.160.226 system.sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.2(4)M3, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Tue 26-Feb-13 03:42 by prod_rel_team
$ snmpwalk -v 2c -c ssss 195.149.160.226 1.3.6.1.2.1.1.1
SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.2(4)M3, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
The thing is that you need to permit requests coming from the polling station in the device config.
Еxample:
snmp-server community sssss RO 10
CPE-TIBC0-IPAC-58844#sh ip access-lists 10
Standard IP access list 10
10 permit 199.99.99.9
20 permit 199.99.99.8
Upvotes: 0
Reputation: 39
You might also checkout the entity mib which usually contains a lot of information regarding a SNMP device's chassis and other components. Cisco seems to populate this MIB quite well...
Parsing the model information from the sysDescr should also be possible for the Cisco devices. However, you have to deal with different formats for all the different hardware platforms.
Upvotes: 1
Reputation: 63264
From SNMP standard, you can find limited information on device model detection, as it gives the vendors enough freedom.
There are two commonly used objects .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID
and .iso.org.dod.internet.mgmt.mib-2.system.sysDescr
whose values should be used to query an existing model database you build on your own (or from the vendor channels).
Upvotes: 1
Reputation: 20463
I'd suggest starting with a simple MIB you can find on the Internet and then re-write it using data types from your inventory program. There are also some good books like "SNMP MIB Handbook" and "Understanding SNMP MIBs" that are great resources.
Upvotes: -1