Code

check_pgsql: Determine connection time in µs-resolution.
[nagiosplug.git] / contrib / aix / check_kerberos
1 #! /bin/sh
3 #=========================================================================
4 #  Kerberos Ticket Checker
5 #
6 #  This script is handy if you allow kerberos tickets to expire
7 #  on your nodes.  The script will simply warn you when a node has 
8 #  kerberos tickets expiring on the current date.  This will allow to
9 #  re-initialize the tickets if you wish to do so.
10 #
11 #  Nothing fancy here, all Nagios will show is the number of tickets
12 #  that are going to (or already have) expired.  
13 #
14 #    An item of note:
15 #
16 #      We made no provisions for the weekend.  If tickets expire on the 
17 #      weekend and nobody is around, you won't see a warning on the 
18 #      Nagios console because we look for expired on the current day
19 #      only.  It's a good idea to have this warning emailed to the 
20 #      appropriate admin and if there is something critical that relies
21 #      on Kerberos, you might want to send a page.
22 #
23 #    Authors:  TheRocker
24 #              SpEnTBoY
25 #
26 #    Email:    therocker@pawprints.2y.net
27 #              lonny@abyss.za.org
28 #=========================================================================
30 TMPFILE=/tmp/kerbtmp.hndl
31 DATE=`date +%b' '%d`
33 rsh $1 -l root /usr/lpp/ssp/kerberos/bin/klist | tr -s ' ' | cut -d' ' -f4,5,6 | grep -e "$DATE" > $TMPFILE
36 if [ -s $TMPFILE ]
37 then
38      
39      LINES=`wc -l /tmp/kerbtmp.hndl | cut -c7-8`
40      echo "Kerberos Tickets set to expire --> \c" 
41      echo "$LINES \c"
42      echo "\n"
44     rm -f $TMPFILE
45      exit 1
47 fi
48     echo "Kerberos Tickets are valid"
49     exit 0