Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Report 1

Status
Not open for further replies.

smicro

MIS
Dec 26, 2002
281
US
Currently I'm running /opt/netbackup/bin/admincmd/bperror -U -backstat -hoursago 12 -columns 200 | sort -r to create an error report from the last 12 hours. Having a slight problem however. Backup jobs are set to run twice before erroring out, so if they fail on the first attempt and are successfully on the second attempt the job is successful. I have a couple jobs where the job has failed on it's first attempt but completed successfully on it's second attempt. The first error shows in the error report along with the second successful attempt. Is there
anyway to show a status report of only failed attempts on the second attempt? Thanks.
 
You could also write a shell script around the bperror command to check for duplicate occurances of the same client/policy within the same timeframe and only report the successful job. I have written an extensive failure report that does this as well as a lot of other functionality. The piece that checks multiple clients/policies/schedules in a given timeframe is outlined below. This segment will need some tweaking to work with your environment (ie, something to define the $MASTER variable, as well as $SEARCH_TIME and $SEARCH_DATE). Hope this helps!

------------------------------------------------------------

ROOT=/usr/openv/netbackup
TMPFILE1=/tmp/failures1.$$
TMPFILE2=/tmp/failures2.$$
ERRORS=/tmp/errors.$$
LIVEJOBS=/tmp/joblist.$$
SERVERS=/tmp/report.$$

bpclclients -M $MASTER -allunique -noheader | awk '{print $3}' | sort > $SERVERS

# 01 - Job ID
# 02 - Job Type? (0=Backup, 1=Archive(?), 2=Restore, #4=Duplicate, 6=DB-Backup)
# 03 - Job State (0 is queued, 1 is Active, 3 is Done, 2 is #re-queued, 5 is incomplete )
# 04 - Exit status
# 05 - Policy
# 06 - Schedule
# 07 - Client
# 08 - Media Server
# 09 - Start Time
# 10 - Elapsed Time
# 11 - End Time
# 12 - Storage Unit
# 13 - Attempt (Try)
# 14 - Operation 3 when writing, 0 when positioning
# 15 - KB Written
# 16 - Files Written
# 17 - Pathname
# 18 - Percent Complete (?)
# 19 - Job PID
# 20 - User
# 22 - Policy Type
# 24 - Priority
# 25 - Group
# 26 - Master
# 34 - Parent PID
# 35 - KB/Sec


bpdbjobs -most_columns -M $MASTER | \
gawk 'BEGIN { FS="," }
{
# If the job state is not done ($3) and the job type is a backup ($2).
if ( $3 < 3 && $2 == 0 )
{
if ( ! $5 ) { policy="unknown" } else { policy=$5 }
if ( ! $6 ) { schedule="unknown" } else { schedule=$6 }
if ( ! $7 ) { client="unknown" } else { client=$7 }
if ( ! $10 ) { elapsed="unknown" } else { elapsed=$10/60/60 }
if ( ! $13 ) { attempt="unknown" } else { attempt=$13 }

# If the job is queued, then it does not list policy or schedule
if ( $3 == 0 )
{
policy="Queued"
schedule="Queued"
}

printf ("%s %s %s %.1f %d\n", client, policy, schedule, elapsed, attempt)
}
}' > ${LIVEJOBS}


bperror -M "${MASTER}" -d $(date -d "$SEARCH_DAY $SEARCH_TIME" +"%D %T" ) -l -backstat | grep -v "__DSSU_" | awk '{print $12, $14, $19, $1, $16, $5;
}' > ${ERRORS}

/TMPFILE1

egrep "^${CLIENT} " ${ERRORS} | awk '{print $2, $3, $4, $5, $6}' | sort | uniq | while read CLASS STATUS TIME SCHED MEDIASERVER
do
if [ "${TESTCLASS}" != "${CLASS}" ]
then
if [ "${STATUS}" -gt 1 ]
then
{
# Active logic does NOT take the schedule into
# account. In general, there shouldn't be two
# schedules in a policy running at the same time

unset ACTIVE
ACTIVE=$(cat ${LIVEJOBS} | egrep "${CLIENT}" | egrep "${CLASS}" )

if [ ! "${ACTIVE}" ]
then
echo "${CLIENT} ${CLASS} ${STATUS} ${TIME} ${SCHED} $MEDIASERVER"
fi
}
else
{
SUCCESSES=$( echo "$SUCCESSES + 1" | bc )
}
fi
TESTCLASS=${CLASS}
fi
done
} > ${TMPFILE1}

for CLIENT in $( cat ${TMPFILE1} | awk '{print $1}' | sort | uniq )
{
for CLASS in $( cat ${TMPFILE1} | egrep "^$CLIENT " | awk '{print $2}' | sort | uniq )
{
for SCHED in $( cat ${TMPFILE1} | egrep "^$CLIENT " | egrep -w "$CLASS" | awk '{print $5}' | sort | uniq )
{
STATI=$(egrep "^${CLIENT} " ${ERRORS} | awk '{print $2, $3, $5}' | egrep "^${CLASS} " | awk '{print $3, $2 }' | egrep "^$SCHED " | awk '{print $2}'
do
echo "${STATUS},\c"
done | sed -e "s/,$//")

# 2 Client
# 6 Backup ID
# 7 Policy
# 8 Policy Type
# 10 Creator
# 11 Sched Label
# 12 Schedule Type
# 13 Retention Level
# 14 Backup Time
# 15 Elapsed Time
# 16 Expiration Time
# 17 Compressed
# 18 Encrypted
# 19 Kilobytes
# 20 Number of Files
# 21 Number of Copies
# 22 Number of Fragments
# 23 DB Compressed
# 24 Files File Name
# 25 Previous Backup Files File Name
# 26 SW Version
# 27 Options
# 28 MPX
# 29 TIR Info
# 30 TIR Expiration
# 33 Primary Copy
# 45 Job ID
# 46 Num Resumes
# 48 Files File size

LAST_IMAGE=$(bpimagelist -M $MASTER -client $CLIENT -d 1/1/70 -policy $CLASS -sl $SCHED -l 2>&1 | egrep "^IMAGE" | head -1 | awk '{print $14}')

if [ ! "$LAST_IMAGE" ]
then
DAYS_AGO="never"
else
DAYS_AGO=$( echo "$( echo "$NOW - $LAST_IMAGE" | bc ) / 86400" | bc )
fi

printf "%-5s %-35s %-25s %-20s %s\n" "$DAYS_AGO" "$CLIENT" "$CLASS" "$SCHED" "$STATI"
}
}
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top