ADSM-L

Re: scripting client's data???

2001-06-28 11:19:02
Subject: Re: scripting client's data???
From: Lawrence Clark <Larry_Clark AT THRUWAY.STATE.NY DOT US>
Date: Thu, 28 Jun 2001 11:18:15 -0400
#!/usr/bin/ksh

# Define the location of the log.
LOC=/home/root/tsmfiles

# Get the total number of bytes received by the TSM server last night.
tempv=`/bin/dsmadmc -password=admin -id=uoieax "select sum(LASTSESS_RECVD)
as BytesYesterday from nodes" | /bin/grep -A2 BYTEYESTERDAY | /bin/tail -1 | /bi
n/head -1`

# Convert bytes to MB.  Use awk since it can handle decimal numbers
bytes=`echo $tempv | /usr/bin/awk 'BEGIN {sum=0} {sum = $1 / 1000000} END {print
 sum}'`

# Create an entry in the log.
print `/usr/bin/date +%m/%d/%Y` $bytes >>  $LOC/daily.log

exit 0


~
~
~
"tsmmegs" 18 lines, 572 characters
[backup] /home/root/bin # tsmmegs
grep: Not a recognized flag: A
grep: Not a recognized flag: 2
Usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwy] [-p[parasep]] -e pattern_list...
        [-f pattern_file...] [file...]


>>> MTailor AT CARILION DOT COM 06/28/01 10:44AM >>>
Try this script.  It'll create a log called daily.log in the $LOG
directory.  This log will contain two things: date and the number of MB
received.  Import the log file into a spreadsheet and graph it.

In the script, change the location of the directory (LOC) where you want
to save the log file.  One thing the script does not do is prune the log
after a certain number of days/months/years worth of entries.

================== Script Starts Here =============================

#!/usr/bin/ksh

# Define the location of the log.
LOC=/whereever/bytesBackup

# Get the total number of bytes received by the TSM server last night.
tempv=`/bin/dsmadmc -password=admin -id=admin "select sum(LASTSESS_RECVD)
as BytesYesterday \
   from nodes" | /usr/local/bin/grep -A2 BYTESYESTERDAY | /usr/bin/tail
-1 | /usr/bin/head -1`
# Convert bytes to MB.  Use awk since it can handle decimal numbers
# Convert bytes to MB.  Use awk since it can handle decimal numbers
unlike ksh.
bytes=`echo $tempv | /usr/bin/awk 'BEGIN {sum=0} {sum = $1 / 1000000} END
{print sum}'`

# Create an entry in the log.
print `/usr/bin/date +%m/%d/%Y` $bytes >>  $LOC/daily.log

exit 0

=================== Script Ends Here =============================

Add the script as a cron entry and you're done.  Hope this does it for
you.


Mahesh Tailor
WAN Administrator
Carilion Health System
Voice: 540-224-3929
Fax: 540-224-3954

>>> marc.levitan AT PFPC DOT COM 06/28/01 08:36AM >>>
Hi All-

Every morning I check the activity log with the following query:

query actlog begindate=today-1 begintime=20:00 enddate=today endtime=now
search=ANE4961I originator=client

This tells me total number of bytes transferred from each client the
previous night.

QUESTION:  How can I create a script to automate this?  I would like to
keep this data in a spread sheet for trending purposes.
Has anyone successfully done this?

Thanks!
Marc Levitan
<Prev in Thread] Current Thread [Next in Thread>