Hello guys!
I am implementing auto-discovering application based on SNMP protocol. Each network device (typically Cisco router or switch) is presented in my system in terms of templates. Templates specify the general structure of device class (number of interfaces, required attributes, etc). Thus, all registered devices are empty.
The problem lies in filling all required attributes (interface's index, name, description). It's not a problem in simplest case - I can get these values via SNMP. All what should I know is OID. Suppose I want to fill three attributes for each of 26 interfaces of my device (attributes and number of interfaces are specified in template). The simplest algorithm is shown below: for N in (1..26) { index = SnmpGet(ifIndex.N); name = SnmpGet(ifName.index); desc = SnmpGet(ifDesc.index); FillDevice(index, name, desc); }
Unfortunately, there are several cases when I can't associate all necessary attributes with a number N. Suppose a device have an interface with name "Gig0/0" and this name is a primary ID of device in my application. So, how can I determine an index of this interface? Obvious solution is to execute a command like this: snmpwalk .... | grep "Gig0/0" | grep ... | awk .... but it's awkward approach.
It seems to me that I am not the first who trying to solve this problem. Can anyone refer me to useful documentation, open source projects, etc. It is possible at all to automatically discover entire network using SNMP?
Thanks!