Bperror command
- 10 years ago
Alright.
below command is giving both policy name, error code and successfull 0 code as well
bperror -d 12/23/2010 16:00:00 -e 12/23/2010 17:00:00 -t backstat -U
But if we require all the same information excluding successfull 0 code. I mean only error codes, clients and policy?
- 10 years ago
That is not what bperror command is for.
bperror -backstat is the equivalent of the GUI Backup Status report.
It gives status of ALL backups for the period in your command. - 10 years ago
Easy to extract the data from OpsCenter
Reports > Backup Reports > Status & Success Rate > Status Reports > All Failed Backups
.
you can edit the result, export or email the report in various formats
save the template in My Reports for quick access so you don't have to drill down the menu each time
- 10 years ago
If you delete a job from activity monitor is disappears from there, but by job database I assume you mean NetBackup's track record of successful jobs with regards to job scheduling, then the answer is no, as NetBackup retains a record of which schedules within policies were successful and when - thus deleting successful jobs from the activity monitor has no impact on scheduling.
If you had a job that was run, and failed, and was deleted from activity monitor, then the only record of that job having taken place would be via 'bperror' command, and not via 'bpdbjobs'.
HTH
Here's a script to list all policies, which have had backups, within the last 24 hours, and a list of all status codes that appear at least once agianst the backup jobs for the policies - as long as the job is still in the activity monitor list.
i.e. this script assumes that jobs have not been deleted from the activity monitor.
I think it should be called something like:
list-policy-status-last-24-hours.bat
@echo off setlocal enabledelayedexpansion enableextensions set z_path=%~dp0 set z_name=%~n0 set z_file_log=!z_path!!z_name!.log set z_file_pol=!z_path!!z_name!.pol set z_file_srt=!z_path!!z_name!.srt set z_file_tmp=!z_path!!z_name!.tmp if exist "!z_file_pol!" del "!z_file_pol!" if exist "!z_file_srt!" del "!z_file_srt!" if exist "!z_file_tmp!" del "!z_file_tmp!" copy /y nul "!z_file_pol!" >nul call :log "" call :log "" call :log "************************************" call :log "Script started..." set z_date_tod=!date! set z_time_now=!time:~0,8! if "!z_date_tod:~3,1!"==" " set z_date_tod=!z_date_tod:~4,10! set z_date_tod_yyyy=!z_date_tod:~6,4! set z_date_tod_mm=!z_date_tod:~3,2! set z_date_tod_dd=!z_date_tod:~0,2! set z_date_yes_yyyy=!z_date_tod_yyyy! set z_date_yes_mm=!z_date_tod_mm! set z_date_yes_dd=!z_date_tod_dd! set /a z_date_yes_dd=!z_date_tod_dd! - 1 if !z_date_yes_dd!==0 ( set /a z_date_yes_mm=!z_date_tod_mm! - 1 if !z_date_yes_mm!==0 ( set /a z_date_yes_yyyy=!z_date_tod_yyyy! - 1 set z_date_yes_mm=12 set z_date_yes_dd=31 ) else ( if !z_date_yes_mm!==1 set z_date_yes_dd=31 if !z_date_yes_mm!==2 ( REM we can ignore the 100 vs 400 rule, for NetBackup, well, until at least around 31st Dec 2099 (anyone remember Y2K?) set /a z_tmp=!z_date_tod_yyyy! / 4 set /a z_tmp=!z_tmp! * 4 if !z_tmp!==!z_date_tod_yyyy! ( set z_date_yes_dd=29 ) else ( set z_date_yes_dd=28 ) ) if !z_date_yes_mm!==3 set z_date_yes_dd=31 if !z_date_yes_mm!==4 set z_date_yes_dd=30 if !z_date_yes_mm!==5 set z_date_yes_dd=31 if !z_date_yes_mm!==6 set z_date_yes_dd=30 if !z_date_yes_mm!==7 set z_date_yes_dd=31 if !z_date_yes_mm!==8 set z_date_yes_dd=31 if !z_date_yes_mm!==9 set z_date_yes_dd=30 if !z_date_yes_mm!==10 set z_date_yes_dd=31 if !z_date_yes_mm!==11 set z_date_yes_dd=30 if !z_date_yes_mm!==12 set z_date_yes_dd=31 ) ) set z_date_tod=!z_date_tod_dd!/!z_date_tod_mm!/!z_date_tod_yyyy! set z_date_yes=!z_date_yes_dd!/!z_date_yes_mm!/!z_date_yes_yyyy! call :log "" call :log "Today's date: !z_date_tod!" call :log "Yesterday's date: !z_date_yes!" set z_nbu_path=C:\Program Files\Veritas\NetBackup set z_bpdbjobs_exe=!z_nbu_path!\bin\admincmd\bpdbjobs.exe if not exist "!z_bpdbjobs_exe!" ( call :log "Unable to locate executable `!z_bpdbjobs_exe!`..." goto :end ) set z_since=!z_date_yes! !z_time_now! call :log "" call :log "Collecting jobs since: !z_since!" "!z_bpdbjobs_exe!" -most_columns -t "!z_since!" >"!z_file_tmp!" set z_sts=!errorlevel! if not "!z_sts!"=="0" ( call :log "call to bpdbjobs failed, status `!z_sts!`..." goto :end ) set /a z_count_backup_jobs=0 set /a z_count_policies=0 for /f "tokens=1,2,3,4,5 delims=," %%a in ('type "!z_file_tmp!"') do ( set z_job_id=%%a set z_job_type=%%b set z_job_state=%%c set z_job_status=%%d set z_job_policy=%%e if "!z_job_state!"=="3" ( set z_job_type_wanted=n if "!z_job_type!"=="0" set z_job_type_wanted=y if "!z_job_type!"=="6" set z_job_type_wanted=y if !z_job_type_wanted!==y ( set /a z_count_backup_jobs+=1 find "!z_job_policy!" "!z_file_pol!" >nul 2>nul if !errorlevel!==1 ( set /a z_count_policies+=1 (echo !z_job_policy!)>>"!z_file_pol!" ) (echo !z_job_status!)>>"!z_file_pol!.!z_job_policy!" ) ) ) call :log "" call :log "Found backup jobs: !z_count_backup_jobs!" call :log "Found policies: !z_count_policies!" Call :log "" sort "!z_file_pol!" /o "!z_file_srt!" for /f "tokens=*" %%a in ('type "!z_file_srt!"') do ( set z_policy=%%a sort "!z_file_pol!.!z_policy!" /o "!z_file_pol!.!z_policy!.srt" set z_status_prev= set z_status_list= for /f "tokens=*" %%a in ('type "!z_file_pol!.!z_policy!.srt"') do ( set z_status=%%a if not "!z_status!"=="!z_status_prev!" set z_status_list=!z_status_list!,!z_status! set z_status_prev=!z_status! ) set z_status_list=!z_status_list:~1,999! set z_policy_disp=!z_policy! * set z_policy_disp=!z_policy_disp:~0,30! call :log "Policy: !z_policy_disp! Statii: !z_status_list!" del "!z_file_pol!.!z_policy!.srt" del "!z_file_pol!.!z_policy!" ) :end call :log "" call :log "Script completed..." echo+ pause exit /b :log (echo !date! !time:~0,8! %~1) (echo !date! !time:~0,8! %~1)>>"!z_file_log!" goto :eof