HP3000-L Archives

February 2003, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Michael Anderson <[log in to unmask]>
Reply To:
Michael Anderson <[log in to unmask]>
Date:
Fri, 21 Feb 2003 11:13:49 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (424 lines)
Jeff,

I'm not sure if this is the kind of thing you want, I think it's a
unique use of CI scripts. To read this email correctly, copy-paste into
something where you can change to a Fixed Font, ea: Courier.

These scripts below I use everyday to monitor my nightly system backup.
We don't have an operator on the night shift; actually we don't have a
night shift at all. So when something gets foobar'd with the backup, I
get, well, it's usually not good in the morning ;-) So I used the CI
scripting capabilities to monitor the CPU usage of the 'STORE.PUB.SYS'
process.

If (for any reason) the CPU usage drops below a variable amount, during
a variable interval, my e3000 will page me once per interval.

This does require one command line to be added to my BACKUP job
stream;
:XEQ CHECKCPU.MONITOR.SISDSYS INTERVAL=120 MINCPU=5

This is basically saying; if this back up job uses less than 5 CPU
seconds during any 120-second interval, then ALERT me.
I made 'INTERVAL' & 'MINCPU' variables because each system environment
is different, and you need to play with these values until you get them
right for your environment.

ALSO: All files required for the monitor must reside in a GROUP that is
not part of the current back up file set!

Below is a list of the monitor components:

ACCOUNT=  SISDSYS     GROUP=  MONITOR

FILENAME  CODE  ------------LOGICAL RECORD-----------  ----SPACE----
--DAYS--
                  SIZE  TYP        EOF      LIMIT R/B  SECTORS #X MX
ACC  MOD

ALERT             255B  FA          43         43   1       48  1  1
    157
BACKMONJ          255B  FA          65         65   1       80  2  8
    400
CHECKCPU          255B  FA          10         10   1       16  1  1
    438
CHECKJOB          255B  FA          68         68   1       80  1  *
    413
COMPLETE          255B  FA          23         23   1       32  1  *
    413
FCOPY     PROG    128W  FB        1229       3088   1     1232  1 16
    443
FGREP     NMPRG   128W  FB         573        573   1      576  1  8
    443
GETCPU            255B  FA          72         72   1       80  2  8
    411
GETINFO           255B  FA          23         23   1       32  1  1
    438
MAILNM    NMPRG   128W  FB         908        908   1      912  4  8
86  443

GROUP     TOTAL:    10 FILES        1 MEGABYTE            3088 SECTORS

Notice the program files, these are locate here so they will not be
part of the current backup file set.
FCOPY, copied from FCOPY.PUB.SYS
FGREP, copied from FGREP.HPBIN.SYS
MAILNM, you can download from
ftp://ftp.vytekmessaging.com/mpe_freeware/




-----Printing ALERT.MONITOR.SISDSYS
Parm msg="No message sent" sub="No subject"
# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ #
# Spring Independent School District                           #
#                                                              #
# MPE/iX CI Script: ALERT.MONITOR.SISDSYS                     #
#           Author: Michael Anderson                           #
#      Create Date: Nov, 28, 2001                              #
#                                                              #
# Sends Email to persons who need to know when the             #
# BACKUP is in trouble. I highly recomend that one of the      #
# Email addresses is a PAGER the supports FLEX (Text) msg's    #
#                                                              #
#                                                              #
# RELATED FILES                                                #
# ---------------                                              #
#         Called by: BACKMONJ.MONITOR.SISDSYS                  #
#         Dependent: MAILNM.MONITOR.SISDSYS                    #
#           Created: MAILIO(Temporary, logon group )           #
#                                                              #
# Design notes:                                                #
# ---------------                                              #
# This cmd file is designed as a component to monitor a        #
# full or partial system backup (STORE.PUB.SYS). It's primary  #
# Function (as stated above) requires that it execute while    #
# a system backup is running. Therefore it is required to      #
# be located in a group/account that is negated from the       #
# STORE file set( [log in to unmask]). Any files to be         #
# accessed by this cmd file must also be negated from          #
# the file set being backed up. This is why I have copied      #
# MAILNM into the above group account.                         #
#                                                              #
#                                                              #
# \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ #
PURGE MAILIO,TEMP  > $NULL
BUILD MAILIO;REC=-88,1,F,ASCII;TEMP
FILE XIO=MAILIO,OLDTEMP
Echo !msg > *xio
CONTINUE
Xeq /SISDSYS/MONITOR/MAILNM;INFO= "-s '!sub' -h 209.113.65.143 &
-f [log in to unmask] &
-t [log in to unmask],[log in to unmask] &
-m *xio"

-----Printing BACKMONJ.MONITOR.SISDSYS
!JOB BACKMONJ,MANAGER.SYS;OUTCLASS=LP,1;PRI=CS;HIPRI
!#  SETVAR HPCMDTRACE TRUE
!# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ #
!# Spring Independent School District                           #
!#                                                              #
!# MPE/iX JOB STREAM BACKMONJ.MONITOR.SISDSYS                   #
!#           Author: Michael Anderson                           #
!#      Create Date: Nov, 28, 2001                              #
!#                                                              #
!# To be streamed by the system backup. Desinged to monitor     #
!# the CPU usage of the backup.                                 #
!#                                                              #
!# This JOB will loop for a infinite number of iterations, until#
!# the backup JOB is no longer running.                         #
!# During each iteration the CPU usage is checked. IF CPU drops #
!# below a minimum value. Email will be sent to the list found  #
!# in /SISDSYS/MONITOR/ALERT. Each iteration will PAUSE for a   #
!# variable number of seconds.                                  #
!#                                                              #
!# The minimum CPU usage AND variable number of seconds to PAUSE#
!# are SET by the backup JOB, AND retrieved by the GETINFO cmd  #
!# script.                                                      #
!# \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ #
!SETVAR LASTCPU 0
!SETVAR ACCUM_CPU 0
!SETVAR CPU_USED 0
!SETVAR BACKUP FALSE
!XEQ GETINFO.MONITOR.SISDSYS
!
!# ------------------------------
!XEQ /SISDSYS/MONITOR/GETCPU
!SETVAR LASTCPU !CPU_USED
!IF BACKUP = FALSE THEN
! XEQ /SISDSYS/MONITOR/ALERT 'Abnormal START of !HPSTREAMEDBY'
'!HPCPUNAME'
!ELSE
! PAUSE !INTERVAL
! WHILE BACKUP DO
!  XEQ /SISDSYS/MONITOR/CHECKJOB !JOBNUM
!  IF ( CHECKJOBOK = FALSE ) AND ( RUNNING = FALSE ) THEN
!   XEQ /SISDSYS/MONITOR/ALERT 'Abnormal End of !HPSTREAMEDBY'
'!HPCPUNAME'
!   SETVAR BACKUP TRUE
!  ENDIF
!  IF ( CHECKJOBOK = TRUE ) AND ( RUNNING = FALSE ) THEN
!   XEQ /SISDSYS/MONITOR/ALERT 'Normal End of !HPSTREAMEDBY'
'!HPCPUNAME'
!   SETVAR BACKUP FALSE
!  ENDIF
!  IF BACKUP = FALSE THEN
!   CONTINUE
!  ELSE
!   PAUSE !INTERVAL
!   XEQ /SISDSYS/MONITOR/GETCPU
!   SETVAR CPU_VARIANCE !CPU_USED - !LASTCPU
!   SETVAR LASTCPU !CPU_USED
!   IF !CPU_VARIANCE > -1 THEN
!    TELLOP Backup CPU=!CPU_VARIANCE during the last !INTERVAL seconds
!    ECHO !HPTIMEF Total usage=!CPU_USED, Interval Usage=!CPU_VARIANCE
Minimum=
!MINCPU
!    IF ( CPU_VARIANCE < !MINCPU ) THEN
!     XEQ /SISDSYS/MONITOR/ALERT '!HPSTREAMEDBY CPU is !CPU_VARIANCE'
'!HPCPUN
AME'
!    ENDIF
!   ENDIF
!  ENDIF
! ENDWHILE
!ENDIF
!EOJ

-----Printing CHECKCPU.MONITOR.SISDSYS
PARM INTERVAL=300 MINCPU=500
PURGE COMPLETE.DATA.SYS
SETVAR START_MINUTES ( !INTERVAL / 60 )
STREAM BACKMONJ.MONITOR.SISDSYS;IN=,,!START_MINUTES
SETVAR FNAME 'BK' + '![STR('!HPLASTJOB',3,10)]' + '.DATA.SISDSYS'
IF FINFO('!FNAME','EXISTS') = FALSE
 BUILD !FNAME;REC=-72,1,F,ASCII;DISC=2
ENDIF
FILE XIO=!FNAME,OLD;ACC=OUT
ECHO #J!HPJOBNUM,!INTERVAL,!MINCPU| > *XIO
-----Printing CHECKJOB.MONITOR.SISDSYS
PARM _JOBNUMBER
# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ #
# Spring Independent School District                           #
#                                                              #
# MPE/iX CI Script: CHECKJOB.MONITOR.SISDSYS                   #
#           Author: Michael Anderson                           #
#      Create Date: Nov, 28, 2001                              #
#                                                              #
# Returns a boolean value named RUNNING for a specific JOB     #
# number, CHECKJOBOK of a specific JOB name.                   #
#                                                              #
# Parameters                                                   #
# ---------------                                              #
#  _JOBNUMBER; The MPE JOB number to be verified as RUNNING,   #
#  AND verified as complete (CHECKJOBOK).                      #
#                                                              #
# The _JOBNUMBER PARM format is {#Jnnnnn}, OR the result of    #
#  ( '#' + '!HPJOBTYPE' + '!HPJOBNUM' )                        #
#                                                              #
# Design notes:                                                #
# ---------------                                              #
# This cmd FILE is designed as a component to monitor a        #
# full OR partial system backup (STORE.PUB.SYS). It's primary  #
# Function (as stated above) requires that it execute WHILE    #
# a system backup is running. Therefore it is required to      #
# be located in a group/account that is NOT PART OF the        #
# STORE FILE SET( [log in to unmask]). Any files to be         #
# accessed by this cmd FILE must NOT BE PART OF                #
# the FILE SET being backed UP. This is why I have copied      #
# FGREP.HPBIN.SYS into the above group account                 #
#                                                              #
# \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ #
#                                                              #
#                                                              #
SETVAR RUNNING FALSE
SETVAR CHECKJOBOK FALSE
IF JINFO('!_JOBNUMBER','EXISTS') = TRUE  THEN
 SETVAR RUNNING TRUE
 SETVAR _myjob JINFO('!_JOBNUMBER','JOBNAME')
 IF FINFO('COMPLETE.DATA.SISDSYS','EXISTS') THEN
  XEQ /SISDSYS/MONITOR/FGREP '-c !_myjob' < /SISDSYS/DATA/COMPLETE >
TEMP3
  INPUT XNUM < TEMP3
  SETVAR INUM !XNUM
  IF INUM > 0 THEN
   SETVAR CHECKJOBOK TRUE
  ENDIF
 ENDIF
ENDIF
#                                                              #
# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ #
# SPECIAL NOTE:                                                #
# __________________                                           #
# IF both RUNNING AND CHECKJOBOK are returned with a           #
# FALSE VALUE, one of the following three conditions           #
# may be TRUE. Number 1 & 2 are errors in the CI script.       #
# So the calling CI script should always assume that           #
# the number 3 condition is true when both RUNNING AND         #
# CHECKJOBOK are FALSE                                         #
#                                                              #
# 1. The JOB number maybe invalid.                             #
#                                                              #
# 2. The JOB JCL did NOT contain the following                 #
#    command 'XEQ /SISDSYS/MONITOR/COMPLETE'                   #
#                                                              #
# 3. The JOB has aborted with a fatal error.                   #
#                                                              #
# \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ #

-----Printing COMPLETE.MONITOR.SISDSYS
# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ #
# Spring Independent School District                           #
#                                                              #
# MPE/iX CI Script: COMPLETE.MONITOR.SISDSYS                   #
#           Author: Michael Anderson                           #
#      Create Date: Nov, 28, 2001                              #
#                                                              #
# Writes JOB indentification DATA to COMPLETE.DATA.SISDSYS     #
#                                                              #
# The calling process should ONLY XEQ this script at           #
# EOJ of a successfull completion of the calling JOB.          #
#                                                              #
#                                                              #
# \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ #

FILE X=COMPLETE.DATA.SISDSYS,OLD;ACC=APPEND
IF FINFO('COMPLETE.DATA.SISDSYS','EXISTS') = FALSE THEN
 BUILD COMPLETE.DATA.SISDSYS;REC=1024,1,F,ASCII;DISC=10000
ENDIF

ECHO !HPINTRODATE!HPINTROTIME !HPJOBTYPE!HPJOBNUM  &
     !HPPIN  !HPJOBNAME    >>*X

-----Printing GETCPU.MONITOR.SISDSYS
# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ #
# Spring Independent School District                           #
#                                                              #
# MPE/iX CI Script: GETCPU.MONITOR.SISDSYS                     #
#           Author: Michael Anderson                           #
#      Create Date: Nov, 28, 2001                              #
#                                                              #
# Returns a hash value of the CPU used by a specific JOB       #
# STORE processes, in a variable name CPU_USED.                #
# ADDITIONALY SET's  JOBNUM of the store processes.            #
#                                                              #
#                                                              #
# Design notes:                                                #
# ---------------                                              #
# :SETVAR JOBNUM '#Jnnnnn'                                     #
# :XEQ {This script}                                           #
# :ECHO !CPU_USED                                              #
#                                                              #
# This cmd FILE is designed as a component to monitor a        #
# full OR partial system backup (STORE.PUB.SYS). It's primary  #
# Function (as stated above) requires that it execute WHILE    #
# a system backup is running. Therefore it is required to      #
# be located in a group/account that is NOT PART OF the        #
# STORE FILE SET( [log in to unmask]). Any files to be         #
# accessed by this cmd FILE must NOT BE PART OF the            #
# the FILE SET being backed UP. This is why I have copied      #
# FCOPY.PUB.SYS, AND FGREP.HPBIN.SYS into the above            #
# group account.                                               #
#                                                              #
# \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ #
#                                                              #
SETVAR CPUHR 0
SETVAR CPUSE 0
SETVAR CPUMS 0
SETVAR CPU_USED 0
PURGE STOREMSG.DATA.SISDSYS
BUILD STOREMSG.DATA.SISDSYS;REC=-256,1,F,ASCII;MSG
FILE MSGOUT=STOREMSG.DATA.SISDSYS,OLD
FILE MSGIN=STOREMSG.DATA.SISDSYS,OLD;ACC=IN
SHOWPROC JOB=!JOBNUM  > TEMP1
XEQ /SISDSYS/MONITOR/FGREP " -i STORE" < TEMP1 > TEMP2
XEQ /SISDSYS/MONITOR/FCOPY "FROM=TEMP2;TO=*MSGOUT"  > $NULL
SETVAR MSGEOF FINFO('STOREMSG.DATA.SISDSYS','EOF')
WHILE MSGEOF > 0 DO
 INPUT MSGREC < *MSGIN
 ECHO !MSGREC
 SETVAR MSGEOF FINFO('STOREMSG.DATA.SISDSYS','EOF')
 SETVAR CPUSTR STR('!MSGREC',6,10)
 SETVAR COLON1 POS(':','!CPUSTR',1)
 SETVAR COLON2 POS(':','!CPUSTR',-1)
 IF COLON1 = COLON2 THEN
  SETVAR CPUHRS 0
  SETVAR CPUMIN ![STR('!CPUSTR',COLON1 -2,2)]
  SETVAR CPUSEC ![STR('!CPUSTR',COLON1 +1,2)]
 ELSE
  SETVAR CPUHRS ![STR('!CPUSTR',COLON1 -2,2)]
  SETVAR CPUMIN ![STR('!CPUSTR',COLON1 +1,2)]
  SETVAR CPUSEC ![STR('!CPUSTR',COLON2 +1,2)]
 ENDIF
 IF !CPUHRS = 0 THEN
  SETVAR CPU_USED !CPU_USED + (!CPUSEC + (!CPUMIN * 60))
 ELSE
  SETVAR CPU_USED !CPU_USED + (!CPUSEC + (!CPUMIN * 60 ) + (!CPUHRS *
3600))
 ENDIF
ENDWHILE
IF CPU_USED < 1  THEN
 SETVAR CPU_USED !CPU_USED * -1
 ECHO BACKUP IS NOT RUNNING
 SETVAR BACKUP FALSE
ELSE
 SETVAR BACKUP TRUE
ENDIF
-----Printing GETINFO.MONITOR.SISDSYS
FILE XIO=BK!HPJOBNUM.DATA.SISDSYS,OLD;ACC=IN
INPUT  BKREC  < *XIO
SETVAR C1 POS(',','!BKREC')
SETVAR C2 POS(',','!BKREC',-1)
SETVAR E1 POS('|','!BKREC',-1)
SETVAR JX 1
SETVAR JY !C1 - 1
SETVAR JLEN !C1 - 1
SETVAR IX !C1 + 1
SETVAR IY !C2 - 1
SETVAR ILEN ( !C2 - ( !C1 + 1 ))
SETVAR CX !C2 + 1
SETVAR CY !E1 - 1
SETVAR CLEN ( !E1 - ( !C2 + 1 ))
SETVAR JOBNUM STR(BKREC,JX,JLEN)
SETVAR MYJOBNAME JINFO('!JOBNUM','JOBNAME')
SETVAR INTERVAL STR(BKREC,IX,ILEN)
SETVAR MINCPU STR(BKREC,CX,CLEN)
ECHO System backup monitor (c) SISD 2001
ECHO Monitor !JOBNUM !HPJOBNAME;Every !INTERVAL Seconds,  Minimum
CPU=!MINCPU
TELLOP .
TELLOP Monitor !JOBNUM !MYJOBNAME;Every !INTERVAL Seconds,  Minimum
CPU=!MINCPU
TELLOP .


--
Michael Anderson
Spring Independent School District
16717 Ella Boulevard
Houston, Texas 77090-4299
office: 281.586.1105
fax: 281.586.1187
-

>>> "VANCE,JEFF (HP-Cupertino,ex1)" <[log in to unmask]> 02/20/03
07:45PM >>>
Hi all,

I will be doing another CI Programming talk at both Solution
Symposia and I'd like to incorporate suggestions from you.

So, if you have some script examples that you find really
useful and are willing to share, or if you have a problem
that you'd like to solve with a CI script, please let me know.

Thanks,
Jeff Vance, vCSY

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2