Page 1 of 1

check_ports Issue on 52 Port Switches

Posted: Wed Aug 14, 2013 9:41 am
by and1100
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:

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
Is there any way to modify this for 52 port switches? I did not see where it's pulling the count from. Thank you!

Re: check_ports Issue on 52 Port Switches

Posted: Wed Aug 14, 2013 11:20 am
by abrist
This looks like my script, so I guess this is my problem :P
Lets check what the walk outputs:

Code: Select all

snmpwalk -v1 -c $COMMUNITY $ADDRESS ifOperStatus
(replace $COMMUNITY and $ADDRESS with the actual values for one of your 52 port switches)
Post the output in code wraps.

Re: check_ports Issue on 52 Port Switches

Posted: Wed Aug 14, 2013 12:22 pm
by and1100
Hi Abrist,

Thank you for the response. I will grab you some outputs shortly!

Re: check_ports Issue on 52 Port Switches

Posted: Wed Aug 14, 2013 12:31 pm
by abrist
Great!