[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1960.0. "Bundled P6 params into 1 ALARM mail message?" by CSC32::W_MCGAW () Tue Dec 17 1991 19:29

    
    I have a customer who would like to output ONE mail message for all 
    entities that have fired within a wildcarded rule expression 
    (note: the entities in the expression are selected via a wildcard).  
    The default is to have one mail message per wildcarded entity.  
    This is not what she wants.  
    
    So, is it possible to tell when the last entity in a wildcarded 
    expression has fired?  If so, she will be able to append the P6 
    parameters of all wildcarded entities to have fired and send out 
    one mail message after the LAST one has fired.
    
    
    Walt
T.RTitleUserPersonal
Name
DateLines
1960.1I don't think there is any way of tellingNANOVX::ROBERTSKeith Roberts - DECmcc Toolkit TeamWed Dec 18 1991 09:0516
RE: .0

>    So, is it possible to tell when the last entity in a wildcarded 
>    expression has fired?  If so, she will be able to append the P6 
>    parameters of all wildcarded entities to have fired and send out 
>    one mail message after the LAST one has fired.

  I don't think there is any way of telling when the last rule has fired
  for a given rule expression & entity class.  The only thing I can think
  of is to compare the timestamps.  The rules containing a child wildcard
  which fire true, should fire within a relativly short period of time; 
  depending on how long it takes to retrieve the data.

  Hope this helps.

  Keith
1960.2A work around to the bundled mail message.CX3PT1::SHOTO::W_MCGAWFri Dec 27 1991 11:23159
Hi,

I had a customer (Refer to .0) @Monsanto who wanted to have a 
wild carded alarm rule that would send her mail after the last entity
alarm had fired.  Below is a copy of her alarm.


$ manage/enterprise
create mcc 0 alarms rule remote_node_state2 -
    expression  = (node4 RCCDR1 remote node * STATE = UNREACHABLE, -
    at every 00:05:00), -
    procedure   = rcc_usr3:[mlwell]mlw_alarm.com,       -
    exception handler   = rcc_usr3:[mlwell]mlw_exception.com, -
    category    = "Node Unreachable",   -
    description = "DECnet Phase IV node is reachable",  -
    queue       = sys$batch,    -
    parameter   = "",   -
    in domain   = ".rcc.vax.domain"
exit
$ exit

This alarm would call mlw_alarm.com and pass the actual string 
of the reported failure to mlw_alarm.com as a P6 parameter.

Here is an example of a P6 parameter:

P6 = Node4 62.645 Circuit SVA-0 Counters Zeroed has occurred
     13-DEC-1991 14:02:50.66


I created two command procedures that work together to accomplish 
her goal.  The first is called MCC_NOTIFY.COM.  It makes sure the 
second procedure (MCC_UPDATE.COM) is running in batch and it also
updates a file called MCC_EVENT_MAIL.TXT when ever the alarm rule
fires again.  Her alarm rule would have to call this procedure
instead of MLW_ALARM.COM or she could rename MCC_NOTIFY.COM to
MLW_ALARM.COM.        

MCC_UPDATE.COM waits for 2 minutes and 30 seconds and then checks
the MCC_EVENT_MAIL.TXT file for any new entries.  If it finds one
it goes back and waits again.  Once it executes and finds no new 
entries, it sends the file (MCC_EVENT_MAIL.TXT) as mail and renames
it to a .MAILED_TXT extension.  The two procedures are included below.

Comments / suggestions to CSC32::W_MCGAW.


$! MCC_NOTIFY.COM
$!
$!++
$!
$! This procedure gets called from your alarm rule.  It builds a file
$! called MCC_EVENT_MAIL.TXT and numbers each P6 parameter it enters
$! into the file.  This allows the MCC_UPDATE.COM procedure (which
$! gets submitted from this procedure) to periodically check the file
$! for new entries.
$!
$!--
$!
$! Initialize symbols.
$init:
$ count = "0"
$ file = ""
$ record = ""
$!
$ set def [w_mcgaw.mcc.alarms]		! Your MCC work directory.
$!            
$! Check the batch queues to see if the MCC_UPDATE.COM
$! procedure is executing.  Submit it if not.
$!
$ show que/batch/brief/noall/output=mcc_que.lis
$ open/read que_input mcc_que.lis
$loop:
$ read/end=end_it que_input que_entry
$ que_entry = f$edit(que_entry,"trim,compress,upcase")
$ if f$extract(0,9,que_entry) .eqs. "MCC_UPDATE" then goto found_entry
$ goto loop
$end_it:
$ submit/noprint/restart [w_mcgaw.mcc.alarms]mcc_update.com
$found_entry:
$ close que_input
$ delete/nolog/noconfirm mcc_que.lis;*
$!
$! Check for the file to store events from the wild carded alarm rule.
$!
$ file = f$search("mcc_event_mail.txt")
$ if file .eqs. "" then $ create mcc_event_mail.txt
$!
$! Open the file and locate the most recent counted entry.
$!
$ open/write/read mcc_output [w_mcgaw.mcc.alarms]mcc_event_mail.txt
$read_loop:
$ read/end=endit mcc_output record
$ goto read_loop
$endit:
$ count = f$edit(f$extract(0,4,record),"trim,compress")
$!
$! Update the count and write the next alarm rule occurrance.
$!
$ if count .eqs. " " then count = "0"
$ count = count + 1
$ write mcc_output "''count'"+"   "+"''p6'"
$ close mcc_output
$ exit



$! MCC_UPDATE.COM
$!
$!++
$!
$! This procedure is submitted to batch by MCC_NOTIFY.COM.
$! It periodically checks the MCC_EVENT_MAIL.TXT file to
$! see if new event information has been added to it.  If
$! no new data is recorded, it mails the MCC_EVENT_MAIL.TXT
$! file to the user or a mailing list.
$!
$!--
$!
$init:
$ set ver	! Allow output to batch log file.  Remove to save disk space.
$ count = "0"
$ old_count = "0"
$start:
$ wait 00:02:30			! Time delay to allow for new event recording.
$ set def [w_mcgaw.mcc.alarms]	! Your MCC work directory.
$!
$! Open and read the MCC_EVENT_MAIL.TXT file
$! and check for alarm rule information.
$!
$ open/read mcc_input mcc_event_mail.txt
$read_loop:
$ read/end=endit mcc_input record
$ goto read_loop
$endit:
$ close mcc_input
$!
$! Check to see if anything is new since last look.
$! This will always be true if this is the first pass.
$!
$ count = f$edit(f$extract(0,4,record),"trim,compress")
$ if 'old_count' .lt. 'count' then goto new_info
$!
$! Send mail (MCC_EVENT_MAIL.TXT) and exit if no new data was added.
$! Mail format is SUBJECT  FILENAME  USER or MAILING LIST
$!
$ mail/subj="Alarm rule info" [w_mcgaw.mcc.alarms]mcc_event_mail.txt w_mcgaw
$!
$! Prevent mcc_event_mail.txt from being reused.
$!
$ rename mcc_event_mail.txt *.mailed_txt
$ exit
$new_info:
$!
$! If new data was found, reset the variables and go for another pass.
$!
$ old_count = "''count'"
$ count = "0"
$ goto start