Categories

ID #1425

My snmpwalk output is incorrect. How can I fix it?

My snmpwalk is gives incorrect output. How can I fix it?

 

If the switch cannot report the output of

 

snmpwalk -c public -v1 -On <switch> .1.3.6.1.2.1.17.7.1.2.2.1.2

correctly then the showport command (and port detection in general) will not work out of the box. For example on a Dell S4148f-ON switch, SNMP failed to detect ports properly due to the switch not reporting snmpwalk output correctly.


A
 workaround for this issue is to create a custom control script in which you write your own logic to extract the MAC addresses from the switch and then MAP them to the correct port:

 

#!/bin/bash
# Example custom switch control script v1.0"

usage() {
echo "$0 <command> <args>"
echo " -h show this help"
echo " --provides list available commands"
}

if [ -z "$1" -o "$1" == "-h" ]; then
usage
exit 1
fi

if [ "$1" == "--provides" ]; then
echo "portbymac"

if [ "$1" == "portbymac" ]; then # lower case : separated
if [ "$2" == "00:00:00:00:00:01" ]; then
echo 1
elif [ "$2" == "00:00:00:00:00:02" ]; then
echo 2
elif [ "$2" == "00:00:00:00:00:03" ]; then
echo 3
elif [ "$2" == "00:00:00:00:00:04" -o "$2" == "01:00:00:00:00:04" ]; then
echo 4
elif [ "$2" == "00:00:00:00:00:0A" ]; then
echo 10
elif [ "$2" == "00:00:00:00:00:0B" ]; then
echo 11
elif [ "$2" == "00:00:00:00:00:0C" ]; then
echo 12
fi
fi

 


Inside the "if [ "$1" == "portbymac" ]; " you can add the logic to extract the MAC addresses and MAP them to ports.

Tags: -

Related entries:

You cannot comment on this entry