/*********************************************************************/ /* PILOOPEX REXX to detect a looping partition */ /*********************************************************************/ /* */ /* This REXX controls CPU-LOAD and goes into intensive mode when */ /* a 100% load is detected to find the cause */ /* when it has identified the pgm it reacts with ,,,, */ /* */ /* */ /* TRACE R? */ DELTA_CPU = 30 /* CPU must be lower by this to realy have it */ HIGH_CPU = 98 /* CPU must be above this to start acting */ measure_m = 2 /* size in minutes of an interval */ /* the above should be big enough to have multiple GETJA */ intense_INT = 4 /* duration in seconds for loop-check */ parts = 4 /* there are so many parititons to check */ pid.1 = 'BG' pid.2 = 'F7' pid.3 = 'F8' pid.4 = 'F9' /* reactP1 = '* This partition is in loop:' reactP2 = ' do whatever you like with it' */ REACTP1 ='CANCEL ' REACTP2 =',FORCE' /*********************************************************************/ ADDRESS LINK 'PICC01 INIT' CALL OPERMSG 'ON' DO FOREVER DO measure_m DO 30 CALL SLEEP 2 /* this should be 2 and above should be 30 */ REQ = OPERMSG('MSGDATA') /* Any operator comm request */ IF LENGTH(REQ) > 0 THEN DO if REQ = 'STOP' THEN EXIT ELSE CALL TALK_USER END END END ADDRESS LINK 'PICC01 DATA' IF RC < 101 THEN CPULOAD= RC ELSE ITERATE IF CPULOAD < HIGH_CPU THEN ITERATE CALL CHECK_PARTS end EXIT /* End of Main Line */ CHECK_PARTS: CALL ASSGN 'STDOUT','SYSLOG' SAY 'PILOOPEX detected a LOOP ' SAY ' tries now to identify the cause' CALL ASSGN 'STDOUT','SYSLST' DO I=1 TO PARTS ADDRESS LINK 'DTRIATTN SUSPEND' PID.I CALL SLEEP intense_int ADDRESS LINK 'DTRIATTN RESUME' PID.I ADDRESS LINK 'PICC02' ADDRESS LINK 'PICC01 DATA' IF RC < 101 THEN CPULOAD_N = RC ELSE DO I=I-1 iterate END CPU_D = CPULOAD - CPULOAD_N IF CPU_D > DELTA_CPU THEN DO CALL ASSGN 'STDOUT','SYSLOG' SAY 'PILOOPEX has identified' PID.I 'as looping' CALL ASSGN 'STDOUT','SYSLST' ADDRESS LINK 'DTRIATTN' REACTP1||PID.I||REACTP2 RETURN END END CALL ASSGN 'STDOUT','SYSLOG' SAY 'PILOOPEX could not identify the cause' CALL ASSGN 'STDOUT','SYSLST' RETURN TALK_USER: CALL ASSGN 'STDOUT','SYSLOG' SAY 'PILOOPEX only understands STOP ' SAY 'the current partitions that are checked, if load is above' HIGH_CPU SAY 'are the following' Parts DO I=1 to PARTS SAY 'partition:' PID.I END SAY 'The load must go down by' DELTA_CPU 'to realy have it' SAY 'the system then issues the following command' SAY REACTP1'..'REACTP2 SAY 'where .. is the partition identified as looping' CALL ASSGN 'STDOUT','SYSLST' RETURN