1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

find and detect error in act log **SCRIPT for TSM on AIX**

Discussion in 'Scripting' started by unpaired, Oct 14, 2011.

  1. unpaired

    unpaired New Member

    Joined:
    Jun 17, 2010
    Messages:
    84
    Likes Received:
    1
    vi /usr/local/scripts/tsm_log.ksh

    LOGFILE=/tmp/tsm_log_kontrol.out
    SEARCHFILE=/usr/local/scripts/exclude.lst
    MFILE=/tmp/tsm_log.out.$$
    kayit=0
    echo "From: TSM Activity Log <xx>" > $MFILE
    echo "Subject: TSM Activity Log Control" >> $MFILE
    echo "To: mail.adres@com.tr" >> $MFILE
    echo "" >> $MFILE
    #echo "Content-type: text/html; charset=US-ASCII" >> $MFILE
    #echo "Content-transfer-encoding: 7BIT" >> $MFILE
    #echo "<HTML><BODY>" >> $MFILE
    #echo "<table border=1 style=\"font-size: 9pt; font-family: Tahoma\">" >> $MFILE
    #echo "<tr><td>TSM Activity Log Analysis</td></tr>" >> $MFILE
    dsmadmc -id=admin -password="xx" -outfile=$LOGFILE "select * from (select NODENAME,DATE_TIME,SEVERITY,MESSAGE from actlog where date_time>=current_timestamp-2 hours) where SEVERITY='D' OR SEVERITY='E' OR SEVERITY='W'"
    if [ -r $LOGFILE ]
    then


    if [ -r $SEARCHFILE ]
    then

    #y=`echo $x | awk '{ print $1 }'`
    while read x
    do
    say=`grep -E -p -v "$x" $LOGFILE|wc -l`
    if [ $say -gt 0 ]
    then
    kayit=`expr $kayit + 1`
    #echo "<tr><td>" >> $MFILE
    grep -E -p -v "$x" $LOGFILE >> $MFILE
    #echo "</td></tr>" >> $MFILE
    fi
    done < $SEARCHFILE
    if [ $kayit -eq 0 ]
    then
    echo "No record found!" >> $MFILE
    fi
    #echo "</table>" >> $MFILE
    #echo "</BODY></HTML>" >> $MFILE
    say=`cat $MFILE|grep NODENAME|wc -l`
    if [ $say -gt 0 ]
    then
    /usr/sbin/sendmail -t < $MFILE
    /usr/bin/rm -f $MFILE
    fi
    fi
    #/usr/bin/rm -f $LOGFILE
    fi




    and;

    SEARCHFILE=/usr/local/scripts/exclude.lst

    ANR0482W|ANR1401W|ANS8000I|ANR0516E|ANR0162W|ANR0516E|ANR2034E|StdPutText|OutDiagToCons|ANR2000E|ReportSQLDiagInfo|eportSQLDiagInfo|outDiagfExt|DbiEvalSQLOutcome|tbSQLExecuteSelect|NewAdmSQLExecute|AdmCommandLocal|SmAdminCommandThread|admCommand|tbSQLExecuteSelect|StartThread|ANR0568W|ANR8216W|ANR1404W|AdmSQLExecute|ANR2939E|Thread<13917>|issued message 9999 from|ANR2939E|ANE4037E|ANR0944E|ANR2022E DELETE PATH|ANR2024EA|ANR2020E|ANR4976W|S170SQLLOG|ANR8345E


    Thanks
     
  2.  
  3. ir2160

    ir2160 New Member

    Joined:
    Apr 18, 2012
    Messages:
    6
    Likes Received:
    0
    Occupation:
    TSM admin
    Location:
    Bangalore
    hi
    i am new to TSM and i am working on TSM 5.5. pls give me step by step procedure for implementing this script.

    Many thanks!!!!
     
  4. unpaired

    unpaired New Member

    Joined:
    Jun 17, 2010
    Messages:
    84
    Likes Received:
    1
    Hello ir2160

    if you have aix platform,
    1)mkdir /usr/local/scripts
    2)vi /usr/local/scripts/tsm_log.ksh
    3)copy and paste include script
    4)wq! exit
    5)vi /usr/local/scripts/exclude.lst
    6) copy and paste include it
    7)edit crontab file

    i hope this helpfulyy
     
  5. ir2160

    ir2160 New Member

    Joined:
    Apr 18, 2012
    Messages:
    6
    Likes Received:
    0
    Occupation:
    TSM admin
    Location:
    Bangalore
    Thank you so much, that worked.
     
  6. ir2160

    ir2160 New Member

    Joined:
    Apr 18, 2012
    Messages:
    6
    Likes Received:
    0
    Occupation:
    TSM admin
    Location:
    Bangalore
    Hello unpaired.
    Could u pls Help me in creating an automated script for AIX which runs every friday. i am actually trying to schedule the script for damaged files.
    here is the script that i need to schedule for every week.

    $ cat rwd_FLETCH_tsm.ksh
    #!/usr/bin/ksh

    pass=`tail -1 /var/tmp/tsm`
    user=`head -1 /var/tmp/tsm`
    DATE=`date +%m%d%y`



    # FOR STORAGE POOL BACKUP
    dsmadmc -id=$user -password=$pass run SPCSTATS_FLETCH >> /tmp/tsmqcss/selectSPCS tats_FLETCH_$DATE.txt
    # dsmadmc -id=$user -password=$pass select ACTIVITY,START_TIME,END_TIME,substr ( cast(max(end_time) - (min(start_time)) as char(29)),1,10) AS "ELAPTIME (D HHMMSS )",CAST((SUCCESSFUL) as char(10)) as "SUCCESSFUL",CAST(FLOAT(SUM(BYTES))/1024/10 24/1024 as DEC(9,4)) AS "GB Xfer'd",cast((end_time-start_time)seconds/60/60 as d ecimal(9,4)) as "HOURS",CAST(CAST((BYTES)/1024/1024/1024 as DEC(10,4))/CAST((end _time-start_time)seconds/60/60 as DEC(10,4)) AS DEC(10,5)) AS "XFER_RATE" from s ummary WHERE activity='STGPOOL BACKUP' and BYTES<>0 group by activity,start_time ,end_time,successful,bytes >> /tmp/tsmqcss/selectSPCStats_FLETCH_$DATE.txt

    # FOR ARCHIVES
    dsmadmc -id=$user -password=$pass run ARCH_FLETCH >> /tmp/tsmqcss/selectARCH_FL ETCH_$DATE.txt
    # dsmadmc -id=$user -password=$pass select ADDRESS,ACTIVITY,START_TIME,END_TIME, substr (cast(max(end_time) - (min(start_time)) as char(29)),1,10) AS "ELAPTIME ( D HHMMSS)",CAST((SUCCESSFUL) as char(10)) as "SUCCESSFUL",CAST(FLOAT(SUM(BYTES)) /1024/1024/1024 as DEC(9,4)) AS "GB Xfer'd",cast((end_time-start_time)seconds/60 /60 as decimal(9,4)) as "HOURS",CAST(CAST((BYTES)/1024/1024/1024 as DEC(8,4))/CA ST((end_time-start_time)seconds/60/60 as DEC(8,4)) AS DEC(8,5)) AS "XFER_RATE" f rom summary WHERE activity='ARCHIVE' group by address,activity,start_time,end_ti me,successful,bytes >> /tmp/tsmqcss/selectARCH_FLETCH_$DATE.txt

    # FOR RETRIEVES
    dsmadmc -id=$user -password=$pass run RETR_FLETCH >> /tmp/tsmqcss/selectRETR_FL ETCH_$DATE.txt
    # dsmadmc -id=$user -password=$pass select ADDRESS,ACTIVITY,START_TIME,END_TIME, substr (cast(max(end_time) - (min(start_time)) as char(29)),1,10) AS "ELAPTIME ( D HHMMSS)",CAST((SUCCESSFUL) as char(10)) as "SUCCESSFUL",CAST(FLOAT(SUM(BYTES)) /1024/1024/1024 as DEC(9,4)) AS "GB Xfer'd",cast((end_time-start_time)seconds/60 /60 as decimal(9,4)) as "HOURS",CAST(CAST((BYTES)/1024/1024/1024 as DEC(8,4))/CA ST((end_time-start_time)seconds/60/60 as DEC(8,4)) AS DEC(8,5)) AS "XFER_RATE" f rom summary WHERE activity='RETRIEVE' and BYTES<>0 and end_time<>start_time grou p by address,activity,start_time,end_time,successful,bytes >> /tmp/tsmqcss/selec tRETR_FLETCH_$DATE.txt

    # FOR TAPE STATUS
    dsmadmc -id=$user -password=$pass run FRAG_LTO_FLETCH >> /tmp/tsmqcss/selectFRA G_LTO_FLETCH_$DATE.txt
    # dsmadmc -id=$user -password=$pass select VOLUME_NAME,STGPOOL_NAME,CAST(float(E ST_CAPACITY_MB) as DEC(9,2)) as "MB of Data",PCT_UTILIZED,PCT_RECLAIM,STATUS,sub str(char(ERROR_STATE),1,3) as "Errors?",ACCESS,substr(char(TIMES_MOUNTED),1,5) a s "# of Mounts" from VOLUMES GROUP BY stgpool_name,volume_name,est_capacity_mb,p ct_utilized,pct_reclaim,status,error_state,access,times_mounted >> /tmp/tsmqcss/ selectFRAG_LTO_FLETCH_$DATE.txt



    # FOR STATISTICS AND STATUS

    dsmadmc -id=$user -password=$pass q stg f=d >> /tmp/tsmqcss/qstgFD_FLETCH_$DATE. txt
    dsmadmc -id=$user -password=$pass q libv f=d >> /tmp/tsmqcss/qlibvFD_FLETCH_$DAT E.txt
    dsmadmc -id=$user -password=$pass q occ >> /tmp/tsmqcss/qocc_FLETCH_$DATE.txt
    dsmadmc -id=$user -password=$pass q auditocc >> /tmp/tsmqcss/qauditocc_FLETCH_$D ATE.txt
    dsmadmc -id=$user -password=$pass q actlog begind=today-31 begint=00:00:00 >> /t mp/tsmqcss/qactlog_FLETCH_$DATE.txt
    sleep 300

    dsmadmc -id=$user -password=$pass q actlog begind=today-31 begint=00:00:00 searc h="Copy" >> /tmp/tsmqcss/qactlogSEARCHCOPY_FLETCH_$DATE.txt
    sleep 150

    # dsmadmc -id=$user -password=$pass q media * stg=CRTHRLT04 f=d >> /tmp/tsmqcss/ qmediaFD_PRIM_FLETCH_$DATE.txt
    dsmadmc -id=$user -password=$pass run Q_FLETCH_PRIM_MEDIA >> /tmp/tsmqcss/qmedia FD_PRIM_FLETCH_$DATE.txt

    # dsmadmc -id=$user -password=$pass q media * stg=CRTHRLTO4_BACKUP_POOL f=d >> / tmp/tsmqcss/qmediaFD_COPY_FLETCH_$DATE.txt
    dsmadmc -id=$user -password=$pass run Q_FLETCH_COPY_MEDIA >> /tmp/tsmqcss/qmedia FD_COPY_FLETCH_$DATE.txt

    dsmadmc -id=$user -password=$pass q log f=d >> /tmp/tsmqcss/qlogFD_FLETCH_$DATE. txt
    dsmadmc -id=$user -password=$pass q db f=d >> /tmp/tsmqcss/qdbFD_FLETCH_$DATE.tx t
    dsmadmc -id=$user -password=$pass q drm f=d >> /tmp/tsmqcss/qdrmFD_FLETCH_$DATE. txt
    dsmadmc -id=$user -password=$pass q volhist type=all >> /tmp/tsmqcss/qvolhistALL _$DATE.txt
    dsmadmc -id=$user -password=$pass q sys >> /tmp/tsmqcss/qsys_FLETCH_$DATE.txt
    dsmadmc -id=$user -password=$pass show DAMAGED CRTHRLT04 >> /tmp/tsmqcss/Prim_da maged_FLETCH_$DATE.txt
    dsmadmc -id=$user -password=$pass show DAMAGED CRTHRLTO4_BACKUP_POOL >> /tmp/tsm qcss/Copy_damaged_FLETCH_$DATE.txt

    Many thanks!!!
     
  7. unpaired

    unpaired New Member

    Joined:
    Jun 17, 2010
    Messages:
    84
    Likes Received:
    1
    Hello ir2160

    Of course i do.
    1)crontab -e
    2) add "05 09 * * 5 /usr/local/scripts/script_name 1>/dev/null 2>/dev/null"
    3)wq!

    exit

    "5" number is every friday.
     
    ir2160 likes this.
  8. ir2160

    ir2160 New Member

    Joined:
    Apr 18, 2012
    Messages:
    6
    Likes Received:
    0
    Occupation:
    TSM admin
    Location:
    Bangalore
    thank you so much, But i did not understand; as u know i am new to AIX and i need step by step procedure to implement this.
    my script name is: rwd_FLETCH_tsm.ksh

    many thanX!!
     
  9. ir2160

    ir2160 New Member

    Joined:
    Apr 18, 2012
    Messages:
    6
    Likes Received:
    0
    Occupation:
    TSM admin
    Location:
    Bangalore
    hi, thank you for your Help again,
    i would also like to schedule an email after the script is executed. Pls advice.

    Many thanks !!!
     
  10. unpaired

    unpaired New Member

    Joined:
    Jun 17, 2010
    Messages:
    84
    Likes Received:
    1
    You're welcome.

    if you have the same script please share it the platform.

    Thank you.
     
  11. dhammika

    dhammika New Member

    Joined:
    May 25, 2011
    Messages:
    4
    Likes Received:
    0
    Hi ir2160,
    This is nice. I am new to TSM and could you please send me followings. It would be to clear understand of this script.

    SPCSTATS_FLETCH
    ARCH_FLETCH
    RETR_FLETCH
    FRAG_LTO_FLETCH
    Q_FLETCH_PRIM_MEDIA
    Q_FLETCH_COPY_MEDIA

    Thanks in advance..
     

Share This Page