>>I'm running ADSM/VM V2.1.08 and want to extract this data from the VM
>>accounting records.
>>Two questions:
>>1) Has anyone else already written such a report and is willing to
>>share?
>>2) If I do a backup and archive or during the same session, does ADSM
>>create two accounting records (one for backup and one for archive)?
Below is a REXX Exec we use to create a similar report using VM accounting
records.
The input file NEWDATE REJECTS * is ADSM VM accounting records. They are
rejects because ADSM has never been "registered" with VM account. It keeps
the search shorter. We don't use very much
information from these records, but I think all of what you're looking for is
there. My apologies for the
nasty spacing on this - Things don't seem to transfer very gracefully from VM
to Lotus Notes.
Hope there's something here you can use.
/*----------------------------------------------------------------------------
------------------*/
------------------*/
/* This exec will run adsmacct and create the file adsm sessions. */ /*
This exec will run adsmacct and create the file adsm sessions. */
/* It will then create separate reports for interested users based */
/* on the activity for a particular ADSM server and send that
*/
/* report to the requesting
user. */
/*----------------------------------------------------------------------------
-----------------*/
-----------------*/
Address COMMAND
Address COMMAND
Signal on NOVALUE
Signal on ERROR
/* trace r */
/*----------------------------------------------------------------------------
-----*/
-----*/
/* Get the month day year for use in calculations */ /*
Get the month day year for use in calculations */
/*----------------------------------------------------------------------------
-----*/
-----*/
rptdate=DATE("U")
rptdate=DATE("U")
usedate=date()
month = substr(rptdate,1,2)
day = substr(rptdate,4,2)
year = substr(usedate,7,5)
/*----------------------------------------------------------------------------
---------------*/
---------------*/
/* Convert the current date to the previous day's date in order to */
/* Convert the current date to the previous day's date in order to */
/* access the previous day's/night's rejects
file. */
/*----------------------------------------------------------------------------
---------------*/
---------------*/
CALL DATECONV
CALL DATECONV
/*----------------------------------------------------------------------------
----------------------*/
----------------------*/
/* Run ADSMACCT to create ADSMRPT to be used in creating */
/* Run ADSMACCT to create ADSMRPT to be used in creating */
/* individual server files to be sent to interested
clients */
/* registered in RPTRCPTS FILE
A. */
/*----------------------------------------------------------------------------
-----------------------*/
-----------------------*/
CALL adsmacct newdate ' rejects *'
CALL adsmacct newdate ' rejects *'
/*----------------------------------------------------------------------------
-----------------------*/
-----------------------*/
/* Create files ADSM1 FILE A, ADSM2 FILE A, ADSM3 FILE A, and */
/* Create files ADSM1 FILE A, ADSM2 FILE A, ADSM3 FILE A, and */
/* DSMCMIS FILE A to be sent to requesting
clients. */
/*----------------------------------------------------------------------------
-----------------------*/
-----------------------*/
CALL rptfiles
CALL rptfiles
CALL sendfile
exit
/*----------------------------------------------------------------------------
---------------------*/
---------------------*/
/* Read ADSM Sessions and create and format a file containing all */
/* Read ADSM Sessions and create and format a file containing all */
/* ADSM client backup
information.
*/
/*----------------------------------------------------------------------------
---------------------*/
---------------------*/
ADSMACCT:
ADSMACCT:
arg FN FT FM .
Signal off ERROR
'ESTATE' FN FT FM /* Check that FN FT FM entered exists */
Signal on ERROR
if RC \= 0 then
do
say 'FILE ' FN FT FM 'DOES NOT EXIST. PLEASE TRY AGAIN.'
exit rc
end
Say 'READING ' FN FT FM '..... PLEASE WAIT'
'PIPE (name ADSMACCT)',
||'| <' FN FT FM , /* Get the accounting recs */
||'| TRUNC 80', /* Trim the records */
||'| LOCATE 1-4 /DSM/', /* select ADSM user recs */
||'| SORT 1-8 73-76 78', /* Order them for merging */
||'| JOIN 1', /* Merge the 2 halves */
||'| SPECS 1-52 1-52', /* Server,Node,Date & Time */
'146 C2D NEXTWORD.1 LEFT', /* Normal Termination */
'53-56 C2D NEXTWORD', /* Duration - Seconds */
'141-144 C2D NEXTWORD', /* CPU Time */
'149-152 C2D NEXTWORD', /* Total data comm. KB */
'57-60 C2D NEXTWORD', /* Archive Objects
*/
'65-68 C2D NEXTWORD', /* Archive Kilobytes */
'113-116 C2D NEXTWORD', /* Archive Objects - ret */
'121-124 C2D NEXTWORD', /* Archive Kilobytes - ret */
'61-64 C2D NEXTWORD', /* Backup Objects */
'69-72 C2D NEXTWROD', /*Backup Kilobytes
*/
'117-120 C2D NEXTWORD', /* Backup Objects - ret */
'125-128 C2D NEXTWORD', /* Backup Kilobytes - ret */
'129-132 C2D NEXTWORD', /* Idle Wait */
'133-136 C2D NEXTWORD', /* Communications Wait */
'137-140 C2D NEXTWORD', /* Media Wait */
'89-112 NEXTWORD', /* Client owner,type,comm */
||'| > ADSM SESSIONS A', /* Accumulate records */
||'| SORT 1-5 9-38 39-52', /* Order by SERVER/NODE/DT */
||'| STEM ADSM.'
say 'REPORT ADSMRPT FILE A HAS BEEN SUCCESSFULLY CREATED.'
if RC ¬= 0 then exit RC
j=0
TOT_SERV = 0
TOT_CPU = 0
CURR_NODE = " "
do I = 1 to ADSM.0
parse var ADSM.I SERVER NODE 39 YYYY 43 MM 45 DD 47 HR 49 MN 51 SS,
53 TERMCODE DURATION CPUTIME,
TCOMM AOI AKBI AOR AKBR BOI BKBI BOR BKBR,
IDLE COMM MEDIA OTHER_INFO
if TERMCODE then
TERMCODE = 'Normal'
else
TERMCODE = ' '
if NODE \= CURR_NODE then do
if I = 1 then
do
C_SERVER = SERVER
end
if SERVER \= C_SERVER then do
j = j+1
rpt.j = ' '
j = j+1
rpt.j = '**** TOTAL KB for Server ' C_SERVER right(TOT_SERV,8),
' ****'
j = j+1
...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
rpt.j = '**** TOTAL CPU Seconds ' C_SERVER right(TOT_cpu,8),
' ****'
j = j+1
rpt.j = ' '
C_SERVER = SERVER
TOT_SERV = 0
TOT_CPU = 0
end
j = j+1
rpt.j = left(SERVER,12) left(NODE,22) 'CPU KB Xfrd Duration'
CURR_NODE = NODE
end
TOTAL_KB = right(AKBI+AKBR+BKBI+BKBR,8)
TOT_SERV = right(TOT_SERV+TOTAL_KB,8)
TOT_CPU = right(TOT_CPU+CPUTIME,8)
j=j+1
rpt.j=' 'MM'/'DD'/'YYYY ' ' HR':'MN' ' TERMCODE,
right(CPUTIME,8) TOTAL_KB right(DURATION,8)
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
end
j = j+1
rpt.j = ' '
j = j+1
rpt.j = '**** TOTAL KB for Server ' C_SERVER right(TOT_SERV,8),
' ****'
j = j+1
rpt.j = '**** TOTAL CPU Seconds ' C_SERVER right(TOT_CPU,8),
' ****'
rpt.0=j
'PIPE STEM RPT.|PAD 132|> ADSMRPT FILE A|STEM ADSMRPT.'
if RC = 0 then 'PRINT ADSMRPT FILE A'
RETURN
RPTFILES:
prevsrvr = ' '
j = 0
currsrvr = ' '
do i = 1 to adsmrpt.0
Parse var adsmrpt.i char1 2 fserver 8 therest 79
select
when i = 1 then
do
prevsrvr=char1||fserver
currsrvr=char1||fserver
j = j+1
out.j = ' '
end
otherwise
end
if (char1 = 'A')|(char1 = 'D') then
do
currsrvr = char1||fserver
end
if currsrvr = prevsrvr then
do
j = j+1
out.j = char1||fserver||therest
end
if currsrvr /= prevsrvr then
do
srvrfile = prevsrvr||' file a'
prevsrvr = currsrvr
out.0=j
'PIPE stem out.|> ' srvrfile
j = 0
j = j+1
out.j = ' '
j = j+1
out.j = char1||fserver||therest
end
if i = adsmrpt.0 then
do
j = j+1
srvrfile = currsrvr||' file a'
out.0=j
'PIPE stem out.|>' srvrfile
end
end
RETURN rc
/*----------------------------------------------------------------------------
-------------------*/
-------------------*/
/* Read the file containing the list of report recipients and send
/* Read the file containing the list of report recipients and send
*/
/* the file for the appropriate server to the userid in the
file. */
/* The "X" variables below are required header information for the */
/* SENDTCP command.
*/
/*----------------------------------------------------------------------------
------------------*/
------------------*/
SENDFILE:
SENDFILE:
'PIPE CP QUERY TIME|SPLIT|DROP 2|TAKE 2|JOIN * / /|VAR TIMEANDZONE'
Parse value date("Standard") with year 5 . 7 day
'PIPE < rptrcpts file | STEM rcpts.'
x.0 = 5
x.1 = "OPTIONS: NOACK NOLOG SHORT NONOTEBOOK ADSM CLASS A"
x.2 = "Date:" day date("Month") year TimeAndZone
x.3 = "From: ADSTAR Distributed Storage Manager"
x.5 = "Subject: ADSM Report"
do i = 1 to rcpts.0
Parse var rcpts.i sendsrvr 7 address
say 'address = "'address'"'
say 'Sendsrvr ="'sendsrvr'"'
Parse var address user "@" address
If address = ""
Then address = user
Else address = user "at" address
X.4 = "To: " address
SENDSRVR = sendsrvr "FILE A"
"PIPE STEM X.",
||"| APPEND <" sendsrvr,
||"| > ADSM NOTE A"
"EXEC SENDTCP ADSM NOTE A (NOTE NOLOG NOACK NEW TYPE"
end
RETURN
/*----------------------------------------------------------------------------
--------------------*/
--------------------*/
/* Subtract one day from the current date and adjust the month and */ /*
Subtract one day from the current date and adjust the month and */
/* year if necessary.
*/
/*----------------------------------------------------------------------------
-------------------*/
-------------------*/
DATECONV:
DATECONV:
leapyear = 'n'
if year//4 = 0 then leapyear = 'y'
if year = 2000 then leapyear = 'n'
maxmnths = 12
newyear = space(year,0)
newmonth = space(month,0)
newday = space(day - 1,0)
say 'NEWYEAR =*' newyear '*'
say 'NEWMONTH =*' newmonth '*'
say 'NEWDAY =*' newday '*'
if (newday = 0) & (newmonth = 1 ) then
do
newday = 31
newmonth = maxmnths
newyear = year - 1
end
if (newday = 0) & ((newmonth = 5)|(newmonth = 7)|(newmonth = 10)|,
(newmonth = 12)) then
do
newday = 30
newmonth = month - 1
end
if (newday = 0) & ((newmonth = 2)|(newmonth = 4)|(newmonth = 6)|,
(newmonth = 8)|(newmonth = 9)|(newmonth = 11)) then
do
newday = 31
newmonth = month - 1
end
if (newday = 0) & (newmonth = 3) & (leapyear = 'y') then
do
newday = 29
newmonth = month - 1
end
if (newday = 0) & (newmonth = 3) & (leapyear = 'n') then
do
newday = 28
newmonth = month - 1
end
if newday < 10 then
do
newday = '0'||newday
end
newdate = substr(newyear,3,2)||newmonth||newday
say "Newdate = *" newdate "*"
RETURN newdate
NOVALUE:
Parse source . . ename etype emode .
Say "Uninitialized variable referenced at line",
sigl "of" ename etype emode":"
Say sourceline(sigl)
Exit rc
ERROR:
If word(sourceline(sigl),1) = "If"
Then sigl = sigl - 1
Parse source . . ename etype emode .
Say "Return code" rc,
"from line" sigl "of" ename etype emode":"
Say sourceline(sigl)
Say condition("Description")
If symbol("COMMAND") = "VAR"
If symbol("EMSG.0") = "VAR"
Then do i = 1 to emsg.0
Say "Message =" emsg.i
End
Exit rc
|