#!/bin/sh # # Try to fetch the WL version information via SNMP # # Rick van der Zwet # PATH="/usr/local/bin:/usr/bin" HOSTNAME=$1 # XXX: Make me more dynamic somehow LAST_GOOD_REV=${2:-8700} if [ "$1" = "-h" ]; then echo "Usage: $0 []" exit 0 fi if [ -z "$HOSTNAME" ]; then echo "VERSION UNKNOWN: No remote host specified" exit 3 fi WL_VERSION=`snmpget -Ovq -c public -v2c $HOSTNAME nsExtendOutput1Line.\"wl-version\"` if [ -z "$WL_VERSION" -o $? -ne 0 ]; then echo "VERSION CRITICAL: Cannot get results via SNMP" exit 2 fi REV=`echo $WL_VERSION | cut -d@ -f 2` if [ $REV -lt $LAST_GOOD_REV ]; then echo "VERSION WARNING: $WL_VERSION too old, needs to be at least $LAST_GOOD_REV.|version=$REV" else echo "VERSION OK: $WL_VERSION|version=$REV" exit 0 fi