This is the script I am using to be notified about tape drives which are in the DOWN or AVR status. I am running it from crontab every 30 mins, and if any drive is in DOWN or AVR state I am sending out an emial to me, and in some locations is created ticket. If something goes wrong we are notified with maximum 30 minutes delay about DOWNed or AVR tape drive statues!!
Please check out comments in this script. I think it is well commented out.
Script is meant to be run on the UNIX Master/Media servers - I have tested it on AIX 5.3, but I think other UNIX platform should be fine too.