check_interfaces.sh

#!/bin/sh
 
# checkt ob alle Interface up sind und Link haben und liefert einen fuer Nagios gueltigen Return-Wert
 
CARDS="dev0 eth1 eth2 eth3"
 
DEBUG=0
MESG=""
INTOK="OK:"
 
for card in $CARDS
do
        if [ $DEBUG -gt 0 ]
        then
                echo -n "Testing $card "
        fi
        ret=$(ethtool -t $card online > /dev/null 2>&1 ; echo $?)
        if [ $ret -gt 0 ]
        then
                echo "CRITICAL: Interface $card failed!"
                exit 2
        else
                INTOK="$INTOK $card"
        fi
done
echo "$INTOK operating normally"
exit 0

Revision #1
Created 27 July 2021 10:07:21 by magenbrot
Updated 27 July 2021 10:07:36 by magenbrot