4
0

check_kerberos 1.5 KB

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