| $! BROADCAST.COM SNS action routine.
$!------------------------------------------------------------------------------
$! Abstract
$!
$! Broadcasts event details on the specified operator's terminals
$! and/or mails them to the specified mail address.
$!------------------------------------------------------------------------------
$! Configuration
$!
$! o On operator's terminal(s)
$!
$! $ set broadcast=general
$! $ set terminal/broadcast
$!
$! o Profile setup
$!
$! SNS$EDIT> add action_routine_set broadcast/mode=spawn/log_file -
$! /command=@sys$login:broadcast.com -
$! /output=sys$login:broadcast.log
$! SNS$EDIT> modify class default/event=all/action_routine_set=broadcast
$! SNS$EDIT> modify external_message_class default /pos=1 -
$! /action_routine_set=broadcast
$!
$! o System mgt. -- the Consolidator needs to spawn the action routine with
$! -- the OPER privilege, so...
$!
$! $ instal replace sys$system:sns$consolidator.exe /priv=oper
$!
$! o Mail address / operator to notify - see below...
$!
$!------------------------------------------------------------------------------
$! Edit the following symbols definitions to direct notification to
$! the operator on duty...
$!
$ operator := hurez
$ operator_vaxmail := ccomca::hurez
$!
$!------------------------------------------------------------------------------
$ w := write sys$output
$!
$!------------------------------------------------------------------------------
$! Trace and decode parameters...
$!
$! i = 1
$! loop:
$! w "P''i': <" + P'i' + ">"
$! i = i + 1
$! if i .le. 8 then goto loop
$!
$!
$ ful = P1 ! Full event message time stamp + node + text.
$ txt = f$extract(20,112,P1) ! Extract event text...
$ ! (20 1rst characters are timestamp & nodename)
$ dat = f$edit(P2,"trim") ! Date/time stamp
$ evc = f$extract(6,3,P3) ! Event code (CPU, MEM, DSK, DNF, ...)
$ nod = f$edit(P4,"trim") ! Nodename
$ clu = f$edit(P5,"trim") ! Cluster name
$ act = f$edit(P6,"trim") ! Action routine set name
$ sts = f$extract(6,3,P7) ! Status code (NEW, UPDate, REMoved...)
$ prm = f$edit(P8,"trim") ! Event message parameters
$!
$!------------------------------------------------------------------------------
$! Filter out everything but new messages
$! (comment out next line to view event updates & removals as well as news)
$!
$! if sts .nes. "NEW" then goto clean_and_exit
$!
$!------------------------------------------------------------------------------
$! Build message to be displayed to the operator.
$!
$ if ( nod .nes. clu )
$ then loc = f$string(nod+" (cluster "+clu+")")
$ else loc = nod
$ endif
$!
$ msg = "PSW ''sts' ''evc' on ''loc': """"''txt'"""""
$!
$!------------------------------------------------------------------------------
$! Either issue a reply to operator's terminals or mail him with event data.
$! (comment out unnecessary lines)
$!
$! Reply to terminal
$!
$ set process/priv=oper
$ reply/user='operator' "''msg'"
$!
$! Use VAXmail
$!
$! mail nl: 'operator_vaxmail' /subject='f$string(msg)
$!
$!------------------------------------------------------------------------------
$! Now, cleanup and exit
$!
$clean_and_exit:
$!
$! Purge logfiles...
$!
$ if f$mode() .eqs. "BATCH"
$ then
$ logfile = "sys$login:" + f$parse(f$environ("procedure"),,,"name") + ".LOG"
$ else
$ logfile = f$environ("procedure") - ".COM" + ".LOG"
$ endif
$!
$ if f$search(logfile) .nes. "" then purge/nolog/keep=2 'logfile'
$!
$ exit
|