check_ports Issue on 52 Port Switches
Posted: Wed Aug 14, 2013 9:41 am
Hello,
I've notice the check_ports script that was directed to me by these forums (thank you!) is having issues on 52 port switches. It seems that the script is thinking that our 52 port switches have only 24 ports, or it is scanning the first 24 ports. As a result, it throws WARNINGS.
Here is the script:
Is there any way to modify this for 52 port switches? I did not see where it's pulling the count from. Thank you!
I've notice the check_ports script that was directed to me by these forums (thank you!) is having issues on 52 port switches. It seems that the script is thinking that our 52 port switches have only 24 ports, or it is scanning the first 24 ports. As a result, it throws WARNINGS.
Here is the script:
Code: Select all
#!/bin/bash
ADDRESS=$1
COMMUNITY=$2
PORTS=$3
COUNT=$(snmpwalk -v1 -c $COMMUNITY $ADDRESS ifOperStatus | grep notPresent | wc -l)
if [ $COUNT -lt $PORTS ]; then
echo "WARNING! Less than $PORTS ports free | 'ports free'=$COUNT"
exit 1
else
echo "OK! $PORTS ports or more free! | 'ports free'=$COUNT"
exit 0
fi