diff options
author | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
---|---|---|
committer | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
commit | 44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch) | |
tree | a1a4d9f7b92412a17ab08f34f04eec45433048b7 /contrib/aix/check_queue | |
parent | 54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff) | |
download | monitoring-plugins-44a321cb8a42d6c0ea2d96a1086a17f2134c89cc.tar.gz |
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib/aix/check_queue')
-rw-r--r-- | contrib/aix/check_queue | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/contrib/aix/check_queue b/contrib/aix/check_queue new file mode 100644 index 00000000..9f709c54 --- /dev/null +++ b/contrib/aix/check_queue @@ -0,0 +1,67 @@ +#! /bin/sh + +#=============================================================== +# Print Queue Checker +# +# The print queue checker simply looks for an occurance of a +# DOWN queue. A note of warning, if you use remote queues in +# AIX to redirect print jobs from the AIX queue to an NT print +# server that print through DLC rather than IP, it will be very +# s - l - o - w. But it will work. +# +# Author: TheRocker +# Email: therocker@pawprints.2y.net +#=============================================================== + +TMPFILE=/tmp/qtmp.hndl +TMPTOO=/tmp/qtwo.hndl + +#======================================================================= +# +# This script will also work on AIX 4.2.1 BUT you have to change +# the following line. AIX 4.2.1 does not support the -W option +# with lpstat. For AIX 4.2.1 just remove the -W option and it should +# work just fine. +# +#======================================================================= + +`rsh $1 -l root lpstat -W | grep -e "DOWN" | tr -s ' ' | cut -d' ' -f1,3 > /tmp/qtmp.hndl 2> /tmp/q_err` + +if [ -s $TMPFILE ] +then + +#======================================================= +# +# If you've seen the other AIX scripts I wrote you may +# notice that I use this bit of code a lot. Well it +# works and appears to be all purpose. +# +#======================================================= + + LINES=`wc -l /tmp/qtmp.hndl | cut -c8` + LINESCTL=`wc -l /tmp/qtmp.hndl | cut -c8` + + echo "Print Queue DOWN --> \c" + + while [ $LINESCTL != 0 ] + do + + cat $TMPFILE | tail -$LINESCTL > $TMPTOO + cat $TMPTOO > $TMPFILE + LINESCTL=$(( $LINESCTL -1 )) + LINES=$(( $LINES -1 )) + DATA=`head -1 /tmp/qtmp.hndl` + echo "( $DATA ) \c" + + + done + + echo "\n" + + rm -f $TMPFILE + rm -f $TMPTOO + exit 2 + +fi + echo "Print Queues Running... OK" + exit 0 |