summaryrefslogtreecommitdiffstats
path: root/contrib/aix/check_queue
diff options
context:
space:
mode:
authorEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
committerEthan Galstad <egalstad@users.sourceforge.net>2002-02-28 06:42:51 (GMT)
commit44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch)
treea1a4d9f7b92412a17ab08f34f04eec45433048b7 /contrib/aix/check_queue
parent54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff)
downloadmonitoring-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_queue67
1 files changed, 67 insertions, 0 deletions
diff --git a/contrib/aix/check_queue b/contrib/aix/check_queue
new file mode 100644
index 0000000..9f709c5
--- /dev/null
+++ b/contrib/aix/check_queue
@@ -0,0 +1,67 @@
1#! /bin/sh
2
3#===============================================================
4# Print Queue Checker
5#
6# The print queue checker simply looks for an occurance of a
7# DOWN queue. A note of warning, if you use remote queues in
8# AIX to redirect print jobs from the AIX queue to an NT print
9# server that print through DLC rather than IP, it will be very
10# s - l - o - w. But it will work.
11#
12# Author: TheRocker
13# Email: therocker@pawprints.2y.net
14#===============================================================
15
16TMPFILE=/tmp/qtmp.hndl
17TMPTOO=/tmp/qtwo.hndl
18
19#=======================================================================
20#
21# This script will also work on AIX 4.2.1 BUT you have to change
22# the following line. AIX 4.2.1 does not support the -W option
23# with lpstat. For AIX 4.2.1 just remove the -W option and it should
24# work just fine.
25#
26#=======================================================================
27
28`rsh $1 -l root lpstat -W | grep -e "DOWN" | tr -s ' ' | cut -d' ' -f1,3 > /tmp/qtmp.hndl 2> /tmp/q_err`
29
30if [ -s $TMPFILE ]
31then
32
33#=======================================================
34#
35# If you've seen the other AIX scripts I wrote you may
36# notice that I use this bit of code a lot. Well it
37# works and appears to be all purpose.
38#
39#=======================================================
40
41 LINES=`wc -l /tmp/qtmp.hndl | cut -c8`
42 LINESCTL=`wc -l /tmp/qtmp.hndl | cut -c8`
43
44 echo "Print Queue DOWN --> \c"
45
46 while [ $LINESCTL != 0 ]
47 do
48
49 cat $TMPFILE | tail -$LINESCTL > $TMPTOO
50 cat $TMPTOO > $TMPFILE
51 LINESCTL=$(( $LINESCTL -1 ))
52 LINES=$(( $LINES -1 ))
53 DATA=`head -1 /tmp/qtmp.hndl`
54 echo "( $DATA ) \c"
55
56
57 done
58
59 echo "\n"
60
61 rm -f $TMPFILE
62 rm -f $TMPTOO
63 exit 2
64
65fi
66 echo "Print Queues Running... OK"
67 exit 0