I'm trying to create a script in python using snmpwalk to get the current devices connected to my switches and which port are they using (I get the MAC address and then, with a database I have, I make the translation to IP or hostname).
Well, everything is going fine but I realize that the OID number of this information change between some switches.
I'm trying to get this OID: 1.3.6.1.2.1.17.4.3.1.2
This works fine and I get the MACs and the port number.
But in some of my switches is this one: 1.3.6.1.2.1.17.7.1.2.2 And in other ones is: 1.3.6.1.2.1.17.4.3.1.2
I'm quite confuse about that and I'm wondering if I'm doing well looking for the OID number instead the name. Anyway, I tried to find the information using some names (sysUpTime etc) but snmpwalk does not work with names (at least, It does not work for me and I'm not sure which name I have to use to get this information). For example, I tried:
$ snmpwalk -v 1 -c public sea-kmSwitch dot1dTpFdbPort
dot1dTpFdbPort: Unknown Object Identifier (Sub-id not found: (top) -> dot1dTpFdbPort)
I know there are snmp modules in python, but I did not find good documentation and examples (pysnmp, pynetsnmp) so I tried to do the script using the linux commands.
So, the question is: how can I know which OID number I have to get? could I use any OID name? and how?
Thanks and sorry about my english.