Home Directory Plugins Anti-Virus NOD32 NOD32 Update Mirror Version Checker

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

NOD32 Update Mirror Version Checker

Rating
3 votes
Favoured:
1
Hits
98831
Files:
FileDescription
check_nod32updatemirror.shcheck_nod32updatemirror.sh
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This Plugin monitors a NOD32 Update Mirror Server (http) and checks if the update.ver is up to date.
This Plugin monitors a NOD32 Update Mirror Server (http) and checks if the update.ver file matches the current date. If not you can see, that your Update Mirror has stopped working.
Reviews (2)
#!/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
byshaibn, March 7, 2011
1 of 1 people found this review helpful
Well, to be blunt, nice try. The script is fair at best, but has lots of issues.

1. The submitted script was written in a Windows editor, and as such, has lots of ^M at the end of its lines, and so, in Linux it won't execute unless this is fixed.

2. There is a line there that sources a file called utils.sh, which wasn't submitted and if you look at some of the functions the script is using (like print_revision and support, which simply don't exist in the submitted script.

3. The grep that you are using for UPDATESTATUS, simply doesn't work, since you had it at -A 1 but 'version' doesn't exist in line 1 of that grep, for me I had to change it to something like -A 10 in order to find the 'version' and be able to grep it.

4. There is an 'if test ${ALARMVAL}', which calls for $5 ... again, which isn't being given to the script at any point... so what is $5 for/suppose to be?

---
Having said all that, the script does give you a head start if you are going to need it and if you have time to edit it to match and work for you.