Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
This Plugin monitors a NOD32 Update Mirror Server (http) and checks if the update.ver is up to date.
Current Version
Last Release Date
June 22, 2009
Owner
Nagios Exchange
Compatible With
check_nod32updatemirror.sh
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.
#!/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
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.
You must be logged in to submit a review.
To:
From: