Can a message rule "look" at more than 1 message to make a decision?
book
Article ID: 187312
calendar_today
Updated On:
Products
OPS/MVS Event Management & Automation
Issue/Introduction
A message is issued : MSGID1 that notifies of a connection failure, the rule then issues an email to the users.
90% of the time the connection is restored within 1 or 2 seconds. It's desirable to look for the "restored" message (separate message ID) before the email notification is sent.
What is the best way to handle this scenario?
Environment
Component : OPS/MVS
Resolution
Here is a sample code that needs to be customized to include real actions. The code below is just to show the general approach that can be taken. This procedure must be tested in a safe environment before its implementation on a production environment.
Assuming that only one connection is being lost and re-established. 2 regular rules and one dynamic TOD rule are required. The logic is: 1) When the message MSGID1 appears, the global variable GLOBAL.CONNECT is set to DOWN 2) The same rule that intercepts the message MSGID1 enables a dynamic TOD rule to be executed in 5 seconds. The code of this dynamic TOD rule checks if the value of the global GLOBAL.CONNECT variable is still DOWN. If it is, then it issues a message 'RESOURCE IS STILL DOWN. TAKING ACTIONS'. At this point you need to include the real actions. It can be to call a REXX program to issue alerts. 3) A second message rule intercepts the message MSGID2 and sets the global variable GLOBAL.CONNECT to UP. If this message appears before the dynamic TOD rule expires the action won't be taken.
Here are the rules.
First message rule:
)MSG MSGID1 )PROC A = OPSVALUE('GLOBAL.CONNECT','U','DOWN') RULENAME = "ADH" || LEFT(TIME(S),7) QUEUE ")TOD *+5 SECS" QUEUE ")PROC" QUEUE "STATUS = OPSVALUE('GLOBAL.CONNECT','0')" QUEUE "IF STATUS = 'DOWN' THEN " QUEUE " DO" QUEUE " SAY 'RESOURCE IS STILL DOWN. TAKING ACTIONS'" QUEUE " END" ADDRESS AOF "ENABLE *DYNAMIC."||RULENAME
Second message rule:
)MSG MSGID2 )PROC A = OPSVALUE('GLOBAL.CONNECT','U','UP')