28-Mar-2008

Watching error counts

Here's a simple command procedure to monitor error counts.


$! See end of file for comments
$       say := write sys$output
$       mail_target = "SYSTEM"
$       if .not. f$trnlnm ("SM_ERROR_TABLE", "LNM$SYSTEM_DIRECTORY",,,,"TABLE")
$       then
$           create -
                /name_table -
                /parent=lnm$system_directory -
                /prot=(s:rwed,o:rwed,g:rwed,w:re) -
                sm_error_table
$       endif
$loop:
$       device = f$device ()
$       if device .eqs. ""
$       then
$           goto exit
$       endif
$       errors = f$getdvi (device, "errcnt")
$       device = device - "_" - ":"
$       if errors .eq. 0
$       then
$           if f$trnlnm (device, "SM_ERROR_TABLE") .nes. ""
$           then
$               reset = f$getdvi (device, "error_reset_time")
$               deassign/table=sm_error_table "''device'"
$               sub = "Error count reset for ''device' at ''reset'."
$               mail/sub="''sub' nl: 'mail_target
$           endif
$       else
$           prev_count = f$integer (f$trnlnm (device, "SM_ERROR_TABLE"))
$           if prev_count .lt. errors
$           then
$               sub = "Error count for ''device' increased from " + -
                      "''prev_count' to ''errors'."
$               mail/sub="''sub'" nl: 'mail_target
$           endif
$           define/table=sm_error_table 'device' 'f$string (errors)'
$       endif
$       goto loop
$exit:
$       exit
$!++
$!
$! DESCRIPTION
$!
$!      Very simple command procedure designed to run every 15 minutes
$!      under Kronos to watch changes in error counts on devices on the system.
$!      Store device error counts in a logical name table.
$!
$!      The DCL will report two events.  1) Errors increasing from zero and 2)
$!      the error count being reset to zero.
$!
$! AUTHOR
$!
$!      James F. Duff
$!
$! MODIFICATIONS
$!
$!      Jim Duff        08-Mar-2007
$!      Original version of module
$!
$!--

Posted at March 28, 2008 2:07 PM
Tag Set:

Comments are closed