Dynamic MIB

Kyle Abrahams
Kyle Abrahams used Ask the Experts™
on
Hi All,

I'm wondering if ALL devices have a friendly name / value pairing within their database.  I have come across a device which can change the Name/Value OID depending on which cables are plugged in first.  

(eg:  A will be at .2.1   take everything out and then A will be at .2.3 . . . values would be at .4.1 and .4.3 respectively)

I can work with this by finding the name I need first and then doing a second request on the offset to the value, but I'm writing this for multiple devices (some of which I don't have access to) and need to know if anyone has ever come across a device that had values that could change their OIDs without names.

(I'm fine if OIDs ordering doesn't change and I know what the OID represents, just worried about them shuffling everything around without labeling what value corresponds to what).

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Cyclops3590Sr Software Engineer

Commented:
what specifically are you trying to poll.  Depending upon which OIDs you are polling you will see different behavior with things being removed and added back in.  for example, the ifEntry table is enumerated upon device boot up.  Now if you have hot-swappable interfaces you could pull out the interface and put it back in.  According to the device it will treat it like the same exact interface even if its physically a new card (if its the same type anyway, replacing an ethernet port with a fiber port would obviously be treated different).  However, SNMP doesn't understand that it is the same.  Thus the MIB definition says that any newly detected interfaces will be added to the table with a new ifIndex.  When an interface is removed, it is removed from the table though.

this would explain the behavior you are seeing as the index of the device component is being re-enumerated from index of 2 to an index of 4.
Kyle AbrahamsSenior .Net Developer

Author

Commented:
I'm trying to write a dynamic service so that regardless of device, a value can be polled based on a configuration.

My question is do all devices have a friendly or configurable name.  

For instance, say you can have values pulled for a network switch to get bandwith usage for each jack from *.3.1 to *.3.16.  The table can be dynamically re-arranged (Eg: jack 1 could be .3 or .5 . . . you only know based off of a friendly name in the *.1.1 to *.1.16 subset)  

I would have the user configure my service to look at  *.1.1 range and give it an offset of .2.0 . . . essentially mapping the NAME oid to the VALUE OID.  My service would then lookup the name/value . . . and based off the name I would update my DB (my db name matches the name of the device)

Again, I'm writing this for a bunch of different switches all with different configurations.  Some would just be static (eg: get the value for jack 1 at a certain OID) or dynamic as stated above.  My question is are there devices out there that are dynamic AND there are no configurable friendly names.

I'm thinking I might need 4 columns just to encompass the above scenario . . .

DB id, Device Name,  Device Name OID,  Value Offset OID

Thoughts?
Kyle AbrahamsSenior .Net Developer

Author

Commented:
Actually just realized I need a fifth column:

Sample inserts:

DB ID,  Device name, Device Name OID start, Device Name OID END.  Value Offset OID
  1              Jack #1                *.1.1                          *.1.16                          .2.0

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Cyclops3590Sr Software Engineer

Commented:
so are you creating your own MIB or writing a service that polls an existing MIB?  If an existing  MIB, then which one?  Without knowing the type of data you're trying to go after, I really can't help.  

I can only assume you are going after the ifEntry table since you mention "Jack #1".  In this case the ifIndex can change, but the name of the interface, ifDescr, usually does not.  I say usually, because the vast majority of vendors populate ifDescr with the hardcoded name, like fastethernet1/1 or eth0, and not the user configured name (e.g. Lab Connection).  

at any rate, if this is the information you are going after, you need to look at the IF-MIB.  It contains all the information you need for what information is available and organized, giving you an indication of how your service should be written to parse out the information you're looking for to update your DB.
Kyle AbrahamsSenior .Net Developer

Author

Commented:
Cyclops,

What I'm trying to do is to make a way, REGARDLESS OF MIB, for the user to be able to configure the service to be polled for that MIB.  

Taking the IF-MIB as an example, I'm trying to let the user map a database ID to a Device name (storing the actual name wither that be fastethernet1/1 or eth 0) and then a range to look for the device name in.  Once I find the name, go to an offset of the OID that corresponds to the name and then pull the value needed.

I'm trying to make SNMP as user friendly as possible without someone having to dive down into the why's and how's of OID.

My question is does the above process work for most devices or do you see any flaws in it.
Sr Software Engineer
Commented:
ok, i think I see what you are trying to do.  Keeping with the interface example.  the ifDescr keeps the name, so if it is ethernet4 and the ifIndex is 2 for example, you want the name recorded in the DB to be ethernet4.  Then when the card is pulled and put back in and the ifIndex for ethernet4 becomes 4, then your service would see this (manually or automated) and update the DB to collect stats via SNMP from index 4 instead.

If this is so, then all you should need to do is use one of the table fields, in this case ifDescr, as your key instead of the MIB defined index, ifIndex in this case (you just need to keep a record of which table field you are using as the key.  Keep a record of what the base OID is for the table you are retrieving data from.  Walk the table for your defined key, in this case ifEntry.ifDescr.X.  Compare the results to see if the actual ifINdex, X, value changed.  If so, update the index value in your database.

So, at least, what I would do is for each database ID, you'd have an OIDbase (1.3.6.1.2.1.2.2.1 - for ifEntry).  Then you would have OIDIndex (2 - which would maybe change to 4).  This way, all you need to do is know which value in that table of the MIB you are wanting to poll and you can piece together the entire pollable OID (1.3.6.1.2.1.2.2.1.    16.    2    - ifOutOctets)

There are a couple problems to be aware of though.  
1) Some tables defined in MIBs actually have multiple values to make up the index.  
2) Some tables defined in MIBs have a single index value that spans multiple OID levels.  For example, OSPF uses the IP of its neighbor as the index so you actually get an index of '192.168.1.2' instead of like most where its '1', a single level.  
3) Be wary of the field you choose to be the key.  Depending upon how you implement your service it may get confused.  For example, if ethernet4 gets renamed ethernet5 for some reason but is actually the exact same card/port.
Kyle AbrahamsSenior .Net Developer

Author

Commented:
Can you give me an example of problem 1?  

Will be an issue, but I don't see a way around it.  If the user decides to change the name they'll have to update it in the poll service as well.  It will require some documentation and training but can be explained through.
Cyclops3590Sr Software Engineer

Commented:
TCP-MIB.  The tcpConnEntry is made up of the following:

    INDEX   { tcpConnLocalAddress,
              tcpConnLocalPort,
              tcpConnRemAddress,
              tcpConnRemPort }


Indexes are always  placed by one another though and I'm pretty sure are always the last values making up the OID that is being polled.  So when you record the OIDIndex, there's no reason it can't be recorded as a string instead of an integer.  This way, so long as you know which part makes up the Index for that table, then you are fine.
Kyle AbrahamsSenior .Net Developer

Author

Commented:
Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial