#!/bin/sh # # Pre-generate NetApp volume and qtree cache files for check_netapp-du plugin # Last updated 2012-10-16 by Peter Mc Aulay # CHECKCMD=/data/opsview/nagios/libexec/check_netapp-du TMPFILE=/tmp/netapp-hosts_$$.tmp trap "rm -f $TMPFILE 2>/dev/null; exit 2" INT TERM KILL cat < $TMPFILE USE opsview; SELECT h.name FROM hosts AS h, hostgroups AS g WHERE g.id = h.hostgroup AND g.name = 'NetApp Filers'; EOF # Save original stdin exec 6<&0 # Redirect stdin to $TMPFILE exec <$TMPFILE # Now read will work properly while read server; do echo `date +"%D %T"` $server $CHECKCMD -H $server -v aggr0 -w 100 -c 100 --force-gencache # Don't break the while loop true done rm -f $TMPFILE 2>/dev/null exit 0