01-18-2012 02:37 AM
Hello,
We are currently using the NetBackup Administration Console.
Each day, I am logging into the Console, choosing Reports > All Log Entries and manually running daily reports.
Is there a tool, or script I can use to automate this process?
Regards,
Shane
Solved! Go to Solution.
01-18-2012 08:06 PM
@ECHO OFF SETLOCAL SETLOCAL ENABLEDELAYEDEXPANSION SET PATH=%PATH%;C:\Program Files\Veritas\NetBackup\bin\admincmd ECHO DATE,TIME,SERVER,CLIENT,SEVERITY,JOBID,TYPE,DESC FOR /F "tokens=*" %%i IN ('cmd.exe /C "bperror.exe -all -L -hoursago 24 | findstr /N /R .*"') DO ( SET _line=%%i SET _line=!_line:*:=! IF "!_line!"=="" ( IF NOT "!_date!"=="" ECHO !_date!,!_time!,!_server!,!_client!,!_severity!,!_jobid!,!_type!,!_desc! SET _date= SET _time= SET _server= SET _client= SET _severity= SET _jobid= SET _type= SET _desc= ) ELSE ( IF NOT "!_line:~0,1!"==" " ( SET _num=1 FOR /F "tokens=1,2,3,4,5,6,*" %%i IN ("!_line!") DO ( SET _date=%%i SET _time=%%j SET _server=%%l SET _server=!_server:~2! SET _client=%%m SET _client=!_client:~2! IF "!_client!"=="?" SET _client= SET _jobid=%%n SET _jobid=!_jobid:~2! ) ) ELSE IF !_num!==1 ( SET /A _num=!_num! + 1 FOR /F "tokens=1,2,3,*" %%i IN ("!_line!") DO ( SET _severity=%%i FOR /F "delims=() tokens=1,*" %%i IN ("!_severity!") DO ( SET _severity=%%i ) SET _type=%%k FOR /F "delims=() tokens=1,*" %%i IN ("!_type!") DO ( SET _type=%%i ) ) ) ELSE ( IF "!_desc!"=="" ( SET _desc=!_line:~2! ) ELSE ( SET _desc=!_desc! !_line:~2! ) ) ) ) ECHO !_date!,!_time!,!_server!,!_client!,!_severity!,!_jobid!,!_type!,!_desc!
01-18-2012 02:51 AM
All reports can be run from the command line, take a look at this tech note:
http://www.symantec.com/docs/TECH1672
#edit#
So you can put them in a .bat file and use Windows Scheduler or similar to automnate them for you
01-18-2012 02:56 AM
It's so O.L.D. I'm suprised there's not a preservation order on it! Still valid tho'
A bit more recent: http://www.symantec.com/business/support/index?page=content&id=TECH20462
01-18-2012 03:13 AM
Thats great thank you. But I am looking at the following script:
All Log Entries Report
The All Log Entries report lists all log entries for the specified time period. This report includes the information from the Problems report and Media Log Entries report. This report also shows the transfer rate, which is useful in determining and predicting rates and backup times for future backups (the transfer rate does not appear for multiplexed backups).
# cd /usr/openv/netbackup/bin/admincmd
# ./bperror -U -all [-d <start_date> <start_time> -e <end_date> <end_time>]
Obviously this shows a start date/time and end date/time. Does anyone know the syntax just to run the report for the past 24 hours? As I want to schedule this to happen daily. But only provide information from the last 24 hours...
Thanks again.
01-18-2012 03:18 AM
it includes man page excerpts for each command:
bperror - Produce an error report
SYNOPSIS
/usr/openv/netbackup/bin/admincmd/bperror [-L | -l | -U] [-verbose] [-help]
[-d <mm/dd[/yy hh:mm:ss] ] [-e <mm/dd[/yy hh:mm:ss] ]
[-hoursago <hours ] [-client <name ] [-server <name ]
[-columns <40 or more ] [-all | -problems | -media | -backstat]
so -hoursago 24
01-18-2012 03:23 AM
See Andy - the old ones are sometimes the best!
01-18-2012 03:24 AM
01-18-2012 04:01 AM
:)
Thats great, thank you. I have the data from the last 24 hours being exported to an xls file.
The only issue I notice now, is the data no longer saves in columns, as it once did when we was manually saving the log entries.
Is there a syntax I am missing to enable this?
Thank you.
01-18-2012 04:22 AM
Save it to a text file then open it in Excel - should come straight in using the default option
#edit#
Or try the -l or -L options rather than the -U option to see which gives you the best output - I think they may work better is going straight to a csv file
#edit 2# - re-edited!
Just checked - do it with the -l and to a text file, then open it in Excel and the tab / space delimiter should do the job
01-18-2012 06:00 AM
This still doesnt seem to be putting the data into columns ... Could be something I'm doing wrong.
My syntax that copies to text document works fine...
C:\Windows\system32>"D:\Program Files\Veritas\NetBackup\bin\admincmd\bperror" -all -hoursago 24 > c:\test.txt
Then rename to .csv or .xls and it puts everything in to the first colum but multiple rows.
I then tried:
C:\Windows\system32>"D:\Program Files\Veritas\NetBackup\bin\admincmd\bperror" -all -l -hoursago 24 > c:\test.txt
and then renamed, but still does the same.
Is there something wrong with my command?
Thanks again...
01-18-2012 06:06 AM
Dont rename it - just go to excel and open it (show all files) and the import wizard will guide you - took a look and it is easiest to actually set you own seperators in excel
Doesn't convert perfect on its own by the looks of it
I little bit of vbs scripting could possibly do it but there are too many spaces to get it to work perfectly
01-18-2012 08:03 AM
Hmm, still not outputting correctly.
I have compared the manual vs automated text documents and it seems that in the manual document, everything is seperated by tabs.
See comparison below:
MANUAL (Note all categories at present along top)
AUTOMATED (Scripted)
How do I get all the categories to work with the script and everything seperated by tabs?
Thanks.
01-18-2012 08:38 AM
The issue for bringing it into excel seems to be the first and last rows:
<2>bperror: INITIATING: version NetBackup 7.1 created: 2011020313
<2>bperror: EXIT status = 0
These disrupt it when bringing it into excel (though i agree tabs is not what it does!)
Who is good at vsb?
01-18-2012 08:06 PM
@ECHO OFF SETLOCAL SETLOCAL ENABLEDELAYEDEXPANSION SET PATH=%PATH%;C:\Program Files\Veritas\NetBackup\bin\admincmd ECHO DATE,TIME,SERVER,CLIENT,SEVERITY,JOBID,TYPE,DESC FOR /F "tokens=*" %%i IN ('cmd.exe /C "bperror.exe -all -L -hoursago 24 | findstr /N /R .*"') DO ( SET _line=%%i SET _line=!_line:*:=! IF "!_line!"=="" ( IF NOT "!_date!"=="" ECHO !_date!,!_time!,!_server!,!_client!,!_severity!,!_jobid!,!_type!,!_desc! SET _date= SET _time= SET _server= SET _client= SET _severity= SET _jobid= SET _type= SET _desc= ) ELSE ( IF NOT "!_line:~0,1!"==" " ( SET _num=1 FOR /F "tokens=1,2,3,4,5,6,*" %%i IN ("!_line!") DO ( SET _date=%%i SET _time=%%j SET _server=%%l SET _server=!_server:~2! SET _client=%%m SET _client=!_client:~2! IF "!_client!"=="?" SET _client= SET _jobid=%%n SET _jobid=!_jobid:~2! ) ) ELSE IF !_num!==1 ( SET /A _num=!_num! + 1 FOR /F "tokens=1,2,3,*" %%i IN ("!_line!") DO ( SET _severity=%%i FOR /F "delims=() tokens=1,*" %%i IN ("!_severity!") DO ( SET _severity=%%i ) SET _type=%%k FOR /F "delims=() tokens=1,*" %%i IN ("!_type!") DO ( SET _type=%%i ) ) ) ELSE ( IF "!_desc!"=="" ( SET _desc=!_line:~2! ) ELSE ( SET _desc=!_desc! !_line:~2! ) ) ) ) ECHO !_date!,!_time!,!_server!,!_client!,!_severity!,!_jobid!,!_type!,!_desc!
01-19-2012 02:03 AM
Ok, thank you. Sorry for sounding incompetent, but how do I output the results to a text file?
Never done any VBS...
01-19-2012 02:30 AM
I am still working on this for you as well - nearly there just some tidying up to do - get back to you later with an alternative that does it in one go for you
01-19-2012 02:43 AM
Why not use the standard reports that is available in the free version of OpsCenter?
Reports can be generated and scheduled for automatic email delivery.
01-19-2012 02:51 AM
Thats a good idea Marianne!
Still - I do like the challenge!
01-19-2012 05:28 AM
01-19-2012 07:47 AM
Managed to get Yasuhisa's script working to absolute perfection... I just edited the commas for tabs (within the ECHO Commands), due to the output data having commas which confused the spreadsheet.
I can now output the script straight to xls/csv without any problems.
Thanks again for all your support. Very much appreciate the help from everyone and for getting this issue resolved so quickly.
Regards,
Shane