"Gary L. Paveza, Jr." <[log in to unmask]> wrote:
>In our shop we are attempting to keep a statistics database which
>contains information on users. Information collected will include
>UserName, Account, CPU Time and Wall Time.
>
>Putting the data once collected into a database is no problem, but we
>are having trouble deciding on how to best collect the data.
>Originally we though by adding a simple SHOWME into a logoff UDC and
>redirecting that to a flat file we could get this information, but now
>we realize that on a given day up to 100 people are aborted prior to
>batch cycle and the SHOWME command would not work for them thus ruining
>out data.
<snip>
If you've got system logging event 103 (job termination) enabled, then
you're system log files contain all of the information you need (well, I'm
*pretty* sure that job termination records have all the fields you want).
You can write a job that runs LOGTOOL in SYSDIAG to extract the records of
interest then write them to your database.
Here's an example (although this job extracts job initiation records -- you
get the idea):
!job jeump003,manager.sys,evan;hipri;outclass=lp,1
!setvar hpautocont true
!if hpday=99
!===========================================================
! jeump003.prodjcl.enduser
!
! This job collects session counts for the ENDUSER account
! from the system log files. It uses the information to
! append records in the file EUUSAGE.EVAN.SYS indicating
! the session name and the date that it logged on. It also
! provides counts by ENDUSER session 'type': MGR, DBA, MIS,
! and all other.
!
! Modification Log:
! Date By Description
! ====== ======== ========================================
!
! 940304 Rudderow Initial Version
!
! 940323 Rudderow Append counters to EUDLYSUM file
!
!===========================================================
!endif
!
!
!if hpday=99
!===========================================================
! Purge work files...
!===========================================================
!endif
!
!continue
!purge mp003w1
!
!continue
!purge mp003w2
!
!continue
!purge mp003w3
!
!continue
!purge mp003w4
!
!continue
!purge mp003w5
!
!continue
!purge mp003w6
!
!
!if hpday=99
!===========================================================
! The next section of JCL prepares a SYSDIAG | LOGTOOL 'use'
! file which is used to extract the ENDUSER session
! information. The use file must be 'prepared' by including
! a list of system log files to search -- this eliminates
! need to read every log file on the system just to find
! log records pertaining to today.
!
! Get a list of the system log files that have been written
! to recently. We're using recently (here within the past
! three days) becuase on some versions of MPE/iX system log
! files do not have their modification date updated until
! they are closed. (If we looked only for log files with a
! modification date of today we might not get any qualifying
! files on a not-too-busy system.)
!===========================================================
!endif
!
!run mpex.pub.vesoft
listf log####.pub.sys(moddate>=today-3),6;out=loglist
exit
!
!
!if hpday=99
!===========================================================
! The output from the MPEX LISTF command is a variable
! length temporary file; we need a fixed length permanent
! file...
!===========================================================
!endif
!
!run editor.pub.sys
text loglist
set fixed
set right=72
set length=72
keep mp003w1,unn
exit
!
!
!if hpday=99
!===========================================================
! We need starting and ending log file numbers -- if only
! one log file was qulified by the LISTF, then copy the
! record so that the starting and ending log file numbers
! are the same.
!===========================================================
!endif
!
!if finfo('mp003w1',19) = 1
! run editor.pub.sys
text mp003w1
copy 1,2
keep
exit
!endif
!
!
!if hpday=99
!===========================================================
! On the other hand, if more than 2 log files qualify we
! only need the first and last log file numbers -- so we
! delete everything in between.
!===========================================================
!endif
!
!if finfo('mp003w1',19) > 2
! run editor.pub.sys
text mp003w1
delete first+1/last-1
keep
exit
!endif
!
!
!if hpday=99
!===========================================================
! At this point we have the starting and ending log file
! names; change these to EDITOR change commands, then text
! the SYSDIAG | LOGTOOL use file and use the change commands
! saved in mp003w1 to prepare the use file.
!===========================================================
!endif
!
!run editor.pub.sys
text mp003w1
change 1/4 to "change /$first$/ to /" in first
change 1/4 to "change /$last$/ to /" in last
change ".PUB.SYS" to "/ in all" in all
keep
text uselog.prodlib.enduser
use mp003w1
keep mp003w2,unn
exit
!
!
!if hpday=99
!===========================================================
! The SYSDIAG | LOGTOOL use file complete, invoke SYSDIAG
! and extract the ENDUSER logons for today.
!===========================================================
!endif
!
!sysdiag
outfile=mp003w3
usefile mp003w2
!
!
!if hpday=99
!===========================================================
! The next section uses SUPRTOOL to performs four steps:
!
! 1. From the SYSDIAG | LOGTOOL output, extract only those
! records which contain the job/session name.
!
! 2. Strip out any logon records for MGR.ENDUSER -- only the
! DBA logs on this way, and we don't want to count DBA
! activity.
!
! 3. Strip out entries for three MIS staff members; these
! people are involved in development and training and
! their activity should also not be counted.
!
! 4. Strip out entries for PJDA3218 who is the MpDBA; we
! don't want to track the ManPower DBA's activity
! either.
!
! 5. Apend the remaining records to EUUSAGE.EVAN.SYS along
! with a date stamp.
!
! Along the way we set some counters.
!===========================================================
!endif
!
!run suprtool.pub.robelle
define jobname,1,9
input mp003w3
if jobname = "JOB NAME:"
output mp003w4
xeq
setvar total_sessions !suprtooloutcount
define evandate,1,8
item evandate,date,yyyymmdd
define session,21,8
define user,61,8
define deptnum,25,4
input mp003w4
if user <> "MGR "
output mp003w5
xeq
setvar mgr_sessions !total_sessions - !suprtooloutcount
setvar running_total !suprtooloutcount
input mp003w5
if session <> "RASA3266", "TWBA3266", "EXRA3266"
output mp003w6
xeq
setvar mis_sessions !running_total - !suprtooloutcount
setvar running_total !suprtooloutcount
input mp003w6
if session <> "PJDA3218"
extract evandate=$today
extract " "
extract session
output euusage,append
xeq
setvar dba_sessions !running_total - !suprtooloutcount
setvar eu_sessions !suprtooloutcount
exit
!
!
!if hpday=99
!===========================================================
! Cleanup...
!===========================================================
!endif
!
!continue
!purge evan.diag.sys
!
!continue
!purge mp003w1
!
!continue
!purge mp003w2
!
!continue
!purge mp003w3
!
!continue
!purge mp003w4
!
!continue
!purge mp003w5
!
!continue
!purge mp003w6
!
!
!if hpday=99
!===========================================================
! Display the counters...
!===========================================================
!endif
!
!showvar @_sessions
!
!
!if hpday=99
!===========================================================
! And append them to a file...
!===========================================================
!endif
!
!setvar dba_s dba_sessions
!setvar eu_s eu_sessions
!setvar mgr_s mgr_sessions
!setvar mis_s mis_sessions
!
!setvar mydate "!hpmonth" + "/" + "!hpdate" + "/" + "!hpyear"
!
!file eudlysum,old
!
!echo "!mydate","!dba_s","!eu_s",,"!mgr_s","!mis_s" >> *eudlysum
!
!eoj
|