Veritas-bu

Re: [Veritas-bu] Veritas Netbackup Report Status by each mount point.

2009-12-15 07:43:43
Subject: Re: [Veritas-bu] Veritas Netbackup Report Status by each mount point.
From: "Bluejay Adametz" <bluejay AT fujigreenwood DOT com>
To: Harpreet SINGH <harpreet_singh AT ctl.creative DOT com>
Date: Tue, 15 Dec 2009 07:42:16 -0500
The korn shell script below may help. It's rather resource-heavy as it has 
to go through the catalog and add up what was backed up from under which 
mount points, and produces something that looks like:

# ./bu_by_filesystem fred
Tue Dec 15 07:34:43 PST 2009 Collecting file system information
Tue Dec 15 07:34:55 PST 2009 Client is standard
Tue Dec 15 07:34:55 PST 2009 Identifying last full backup
Last full backup is from 12/11/2009 20:00:07 to 12/11/2009 20:00:07
Tue Dec 15 07:34:58 PST 2009 Scanning catalog...

                             / backed up    3,164,446k bytes,   105306 
files
                         /boot backed up        4,396k bytes,       24 
files
                     /database backed up      204,800k bytes,        5 
files
                      /dev/pts backed up            0k bytes,        1 
files
                          /pbx backed up      800,275k bytes,      884 
files
      /proc/sys/fs/binfmt_misc backed up            0k bytes,        0 
files
                          /sys backed up            0k bytes,        1 
files
       /var/lib/nfs/rpc_pipefs backed up            0k bytes,        6 
files
        /var/named/chroot/proc backed up            0k bytes,        0 
files
/var/named/chroot/var/run/dbus backed up            0k bytes,        1 
files

4,173,918k bytes, 106228 files total

Tue Dec 15 07:35:23 PST 2009 Complete.
#

Here's the script itself. It could probably be implemented in perl or 
something to be more efficient, but maybe this will give you some ideas.

#!/bin/ksh

# Report the amount of stuff backed up by file system

# Validate parameters
if [[ "$1" = "" ]] ; then
   echo "Usage: $1 [client|backupid]"
   exit 1
fi

if [[ $1 = *_* ]] ; then
   # User specified a backup id
   CLIENT=`echo "$1" | cut -d _ -f 1`
   BUDATE=`echo "$1" | cut -d _ -f 2`
else
   CLIENT=$1
   BUDATE=""
fi

# Identify the file systems on the client

echo `date` Collecting file system information >&2
bpcoverage -c $CLIENT | awk '
BEGIN { FOUND_DRIVES=0; }
$0 == "" { FOUND_DRIVES=0; }
FOUND_DRIVES == 1 && substr($1,1,5) != "-----" {
   P=substr($0,1,PATHEND-1);
   while ( P != "" && substr(P,1,1) == " " ) P=substr(P,2);
   while ( P != "" && substr(P,length(P),1) == " " ) 
P=substr(P,1,length(P)-1);
   print P;
}
( $1 == "Drive" && $2 == "Letter" ) || ( $1 == "Mount" && $2 == "Point" ) 
{
   FOUND_DRIVES=1;
   PATHEND=index($0,"Device");
   if ( PATHEND == 0 ) PATHEND=index($0,"Backed Up By Policy");
}
' >/tmp/bu_by_filesystem_$$.tmp

# Find out the client type

if bpplclients -allunique | grep -q "^PC.*$CLIENT$" ; then
   POLICYTYPE="13 -nt_files"
   echo `date` Client is Windows >&2
else
   POLICYTYPE=0
   echo `date` Client is standard >&2
fi

# Set the date range for the bplist. If the user specified a backup image,
# use the date of that image. Otherwise, find the date of the last full
# image for the client, and any other full backup images started within
# 8 hours of that one (to pick up all the streams) and set the date range
# based on those images.

if [[ "$BUDATE" != "" ]] ; then
   STARTDATE=`convdate  "+%m/%d/%Y %H:%M:%S" $BUDATE`
   ENDDATE=`convdate  "+%m/%d/%Y %H:%M:%S" $BUDATE`
else
   echo `date` Identifying last full backup >&2
   /usr/openv/netbackup/bin/admincmd/bpimmedia -client $CLIENT -sl full 
2>/dev/null \
        | grep ^IMAGE \
        | cut -d " " -f 4 \
        | sort -r -t _ -n -k2 \
        | awk -F _ 'BEGIN { CUTOFF=0; }
                    { if ( CUTOFF == 0 ) CUTOFF=$2 - 28800;
                      if ( $2 > CUTOFF ) print $0; }' 
>/tmp/bu_by_filesystem_images_$$.tmp
   STARTDATE=`tail -1 /tmp/bu_by_filesystem_images_$$.tmp | cut -d _ -f 2`
   ENDDATE=`head -1 /tmp/bu_by_filesystem_images_$$.tmp | cut -d _ -f 2`
   if [[ "$STARTDATE" = "" ]] ; then
      echo Could not determine start date of the full backup >&2
      exit 1
   fi
   if [[ "$ENDDATE" = "" ]] ; then
      echo Could not determine end date of the full backup >&2
      exit 1
   fi
   STARTDATE=`convdate  "+%m/%d/%Y %H:%M:%S" $STARTDATE`
   ENDDATE=`convdate  "+%m/%d/%Y %H:%M:%S" $ENDDATE`
   rm /tmp/bu_by_filesystem_images_$$.tmp

   echo "Last full backup is from $STARTDATE to $ENDDATE" >&2
fi

# Now get the catalog data and see how much stuff came from which file 
systems

echo `date` Scanning catalog... >&2
echo >&2
bplist -C $CLIENT -t $POLICYTYPE -s $STARTDATE -e $ENDDATE -l -R / |
awk -v FSTEMP=/tmp/bu_by_filesystem_$$.tmp '
function add_commas ( STRIN ) {
   STROUT="";
   for ( Ic=length(STRIN)-2; Ic>=2 ; Ic=Ic-3 ) STROUT=substr(STRIN,Ic,3) 
"," STROUT;
   STROUT=substr(STRIN,1,Ic+2) "," STROUT;
   STROUT=substr(STROUT,1,length(STROUT)-1);
   return STROUT;
}

BEGIN {
    FSYST[0]="unknown"; FSBYTES[0]=0; FSFILES[0]=0;
    I=1; LONGESTFS=-1;
    while ( ( getline <FSTEMP ) > 0 ) {
       FSYST[I]=$0; FSBYTES[I]=0; FSFILES[I]=0;
       if ( index(FSYST[I],":\\") != 0 ) {
          # UNIX-ize the path for windows systems
          FSYST[I]="/" substr(FSYST[I],1,index(FSYST[I],":\\")-1) "/" 
substr(FSYST[I],index(FSYST[I],":\\")+2);
          gsub("\\\\","/",FSYST[1]);
       }
       if ( LONGESTFS < length($0) ) LONGESTFS=length($0);
       I++;
    }
    MAXFS=I;
}
{
   FILE=substr($0,index($0,$8))
   FOUNDFS=0; FOUNDSCORE=-1;
   for ( I=1; I<MAXFS; I++ ) {
      if ( FOUNDSCORE < length(FSYST[I]) && 
substr(FILE,1,length(FSYST[I])) == FSYST[I] ) {
         FOUNDFS=I; FOUNDSCORE=length(FSYST[I]);
      }
   }
   if ( substr($4,length($4),1) == "K" ) {
      FSBYTES[FOUNDFS]+=substr($4,1,length($4)-1)*1024;
   } else {
      FSBYTES[FOUNDFS]+=$4;
   }
   FSFILES[FOUNDFS]++;
}
END {
   if ( FSBYTES[0] != 0 || FSFILES[0] != 0 ) {
      print add_commas(int(FSBYTES[0])) "k bytes," FSFILES[0] " files 
backed up from an undetermined file system"
   }
   TOTAL_BYTES=FSBYTES[0]; TOTAL_FILES=FSFILES[0];
   for ( I=1; I<MAXFS; I++ ) {
      printf "%" LONGESTFS "s backed up %12sk bytes, %8d 
files\n",FSYST[I],add_commas(int(FSBYTES[I]/1024)),FSFILES[I];
      TOTAL_BYTES+=FSBYTES[I]; TOTAL_FILES+=FSFILES[I];
   }
   print ""
   print add_commas(int(TOTAL_BYTES/1024)) "k bytes, " TOTAL_FILES " files 
total"
}
'
rm /tmp/bu_by_filesystem_$$.tmp

echo >&2
echo `date` Complete. >&2

                                                                      - 
Bluejay Adametz
 
"Hope for the best. Expect the worst. 
 Life is a play. We're unrehearsed." 
  - Mel Brooks 




Harpreet SINGH <harpreet_singh AT ctl.creative DOT com> 
Sent by: veritas-bu-bounces AT mailman.eng.auburn DOT edu
12/14/2009 11:06 AM

To
VERITAS-BU AT mailman.eng.auburn DOT edu
cc
VERITAS-BU AT mailman.eng.auburn DOT edu, 
veritas-bu-bounces AT mailman.eng.auburn DOT edu
Subject
Re: [Veritas-bu] Veritas Netbackup Report Status by each mount point.






Dear All.

Sorry I missed out the mount point in required report.

Example....
Client       Type       Mount Point Status  MediaSvr   Start_Time
End_Time        Elapsed  Kilobytes     Through Put   Files
----------- ------      ----------- ------  --------  ------------
----------        -----  ----------   --------  ------
aceaix1s     Diff       /ABC        0  ebsmaster  10/04/2004 00:11:07
10/04/2004 01:03:53   00:52:46    651929        10Mb      65589
aceaix2s     Diff       /XYZ        0  ebsmaster  10/04/2004 00:11:07
10/04/2004 00:59:42   00:48:35     27478        7 MB       877793
ams1an01p    Diff       /9999       1  ebsmaster  10/04/2004 01:10:15
10/04/2004 01:26:16   00:16:01   3604735        3MB       9873606
ams2an01p    Diff       /TEMP       0  ebsmaster  10/04/2004 01:10:15
10/04/2004 01:21:32   00:11:17    486168        75 MB           7772752
amsaix1d     Diff       /Backup     1  ebsmaster  10/04/2004 00:11:07
10/04/2004 01:03:18   00:52:11    497548        19 MB      777166
amsaix1s     Diff       /Oracle     0  ebsmaster  10/04/2004 00:11:07
10/04/2004 01:43:35   01:32:28   1795347        66 MB           90971473

etc...

With Warm Regards
=-=-=-=-=-=-=-=-=-=-=-=-=-
Harpreet Singh Chana

Phone  :   (O) 6895 - 4326
Fax       :    (O) 6895 - 4991
=-=-=-=-=-=-=-=-=-=-=-=-=-


Notice
The information in this message is confidential and may be legally
privileged.  It is intended solely for the addressee.  Access to this
message by anyone else is unauthorized.  If you are not the intended
recipient,  any disclosure,  copying or distribution of the message,  or
any action taken by you in reliance on it,  is prohibited and may be
unlawful.  If you have received this message in error,  please delete it
and contact the sender immediately.  Thank you.




 
             harpreet_singh 
             <netbackup-forum@ 
             backupcentral.com                                          To 

             >                         VERITAS-BU AT MAILMAN.ENG.AUBURN DOT EDU 
             Sent by:                                                   cc 

             veritas-bu-bounce 
             s AT mailman.eng DOT aub                                     
Subject 

             urn.edu                   [Veritas-bu] Veritas Netbackup 
                                       Report Status by each mount point. 
 
             12/13/2009 09:24 
             AM 
 
 
             Please respond to 
             VERITAS-BU@MAILMA 
             N.ENG.AUBURN.EDU 
 
 





Dear All,

Many thanks for contributing your scripts for various reports. I am ver.
6.5.4 on Red hat. Sorry to say could not find the report where I can
extract the backup details by each mount point.

My Majority backups are being done by multiple data Streams and
Multiplexing.

Not sure if possible I can get the report as

Job ID # Policy Name # Client Name # Mount Point # Start Time # End Time #
Elapsed Time# #MB backup # Backup Status etc… we want to charge to other
departments by the total size of backup. Not you if you want to add some
more…..?

Example....
Client       Type  Status  MediaSvr   Start_Time           End_Time
Elapsed  Kilobytes        Files

aceaix1s     Diff       0  ebsmaster  10/04/2004 00:11:07  10/04/2004
01:03:53   00:52:46    651929          589
aceaix2s     Diff       0  ebsmaster  10/04/2004 00:11:07  10/04/2004
00:59:42   00:48:35     27478           93
ams1an01p    Diff       1  ebsmaster  10/04/2004 01:10:15  10/04/2004
01:26:16   00:16:01   3604735         3606
ams2an01p    Diff       0  ebsmaster  10/04/2004 01:10:15  10/04/2004
01:21:32   00:11:17    486168         2752
amsaix1d     Diff       1  ebsmaster  10/04/2004 00:11:07  10/04/2004
01:03:18   00:52:11    497548          166
amsaix1s     Diff       0  ebsmaster  10/04/2004 00:11:07  10/04/2004
01:43:35   01:32:28   1795347         1473

As I am heaving a server with about 200 mount points. So I want to know 
the
status of each mount point.

Regards,

Harpreet

+----------------------------------------------------------------------
|This was sent by harpreetrajan AT gmail DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------


_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu

ForwardSourceID:NT0011E6C6
_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu





_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu