Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

TGVirus

Reviews(1)
#!/bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 1.1 $' | sed -e 's/[^0-9.]//g'`
UPDATEVERFILE="/tmp/nod32updatever.$$"
NOD32HOST=$1
NOD32PORT=$2

. $PROGPATH/utils.sh

print_usage() {
echo "Usage: $PROGNAME HOST PORT [-v]"
echo "Parameter order must be identical!"
}

print_help() {
print_revision $PROGNAME $REVISION
echo ""
print_usage
echo ""
echo "This plugin checks wether NOD32 Update Mirror is up to date or not."
echo ""
support
exit 0
}

case "$1" in
--help)
print_help
exit 0
;;
-h)
print_help
exit 0
;;
--version)
print_revision $PROGNAME $REVISION
exit 0
;;
-V)
print_revision $PROGNAME $REVISION
exit 0
;;
*)
cd /tmp
# Grab NOD32 update version
wget -q --timeout=7 http://$NOD32HOST:$NOD32PORT/update.ver -O $UPDATEVERFILE

WGETSTATUS=$?

# Figure out if we have any alarms
export CURRENTDATE=`date +%Y%m%d`
export ALARMVAL=`cat $UPDATEVERFILE | grep -c "$CURRENTDATE"`

UPDATESTATUS=`cat $UPDATEVERFILE | grep ENGINE2 -A 13 | grep version= | cut -f2 -d=`
VERSION=`cat $UPDATEVERFILE | grep ENGINE2 -A 13 | grep 'version=' | cut -f2 -d= | cut -f1 -d' '`
VERSIONDATE=`cat $UPDATEVERFILE | grep ENGINE2 -A 13 | grep 'version=' | cut -f2 -d= | cut -f2 -d' ' | tr -d '()'`

# No more data needed, remove our temporary file
rm $UPDATEVERFILE

if test "$3" = "-v" -o "$3" = "--verbose"; then
echo "${UPDATESTATUS}"
echo "${ALARMVAL}"
fi
if test ${WGETSTATUS} -eq 1; then
echo "Unable to get status from http://${NOD32HOST}:${NOD32PORT}/ - check Host and Port settings in $0?"
exit -1
fi
if test ${ALARMVAL} -eq 0; then
echo "NOD32 UPDATE CRITICAL - $UPDATESTATUS"
exit 2
else
echo "NOD32 UPDATE VERSION $VERSION OK - $UPDATESTATUS"
exit 0
fi
;;
esac