PyroX has asked for the wisdom of the Perl Monks concerning the following question:

I am looking for info on CISCO OID's. I have the mibs but cannot seem to get the info I am looking for.

I need the OID that will return any information that you would normally get doing a "sh macs" on a cisco switch.

I need the mac addresses connected to the ports on a switch to be exact.

I don't want to telnet in, for security reasons. If anyone knows anything about this please give me the info.

Replies are listed 'Best First'.
Re: Perl SNMP, CISCO OID
by geektron (Curate) on Sep 12, 2001 at 03:49 UTC
    you can search cisco's site for SNMP support and individual MIBs supported by individual devices.

    it's probably in the CISCO-STACK-MIB.my

      Hey, Thanks but I already downloads ALL the cisco mibs and installed them. I was hoping someone would have written something in perl already and would just know the OID.
      After contacting cisco they gave me a perl script that does what I want to do, but still no OID so I can get the info by doing an snmpwalk.

      Anyway after using their script, I wrote some php to diplay the results, and after tweeking it, or re-writing their script, I may be able to use it.

      Thanks for your help though!
Re: Perl SNMP, CISCO OID (SNMP::BridgeQuery)
by ybiC (Prior) on Sep 13, 2001 at 01:53 UTC
    Would you be willing to post the code that Cisco provided?   I'd sure be interested in seeing their solution.

    By the way, SNMP::BridgeQuery might be of interest.
    From the README:

    BridgeQuery polls a device which respond to SNMP Bridge Table queries and generates a hash reference with each polled MAC address as the key and the associated port as the value. The specific MIBs that are polled are described in RFC1493.

    SNMP::BridgeQuery requires Net::SNMP in order to function.

    Devices can be switches, bridges, or most anything that responds as a OSI Layer 2 component. Layer 3 devices do not generally respond and will cause an error. If an error is generated, it will return a hash reference with a single element ('error') which can be tested for.

    I've not yet used this module, so have no code to offer.

    Update: 2001-09-27
    The OID you want is dot1dTpFdbAddress numeric 1.3.6.1.2.1.17.4.3.1
    example snmpwalk syntax:
    snmpwalk cat5000a public@1003 .1.3.6.1.2.1.17.4.3.1

    Note the "@vlan#" following the ROcommunitystring, and the numeric OID's leading "."
        cheers,
        Don
        striving toward Perl Adept
        (it's pronounced "why-bick")

      It looks like the cisco provided script IS using SNMP, and does it much like you described. I re-wrote/added to some of the code then to gather allot more information. As for giving the code out, I am not sure if I can, as my employer has cisco contracts, and the script may be protected under that. I will look into it though.