cancel
Showing results for 
Search instead for 
Did you mean: 

NetBackup Administration Console - Automated Reporting ?

smarsh88
Level 3

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

1 ACCEPTED SOLUTION

Accepted Solutions

Yasuhisa_Ishika
Level 6
Partner Accredited Certified
@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!

View solution in original post

25 REPLIES 25

Mark_Solutions
Level 6
Partner Accredited Certified

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

Andy_Welburn
Level 6

It's so O.L.D. I'm suprised there's not a preservation order on it! Still valid tho' wink

 

A bit more recent: http://www.symantec.com/business/support/index?page=content&id=TECH20462

smarsh88
Level 3

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.

Andy_Welburn
Level 6

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

Mark_Solutions
Level 6
Partner Accredited Certified

See Andy - the old ones are sometimes the best! smiley

Andy_Welburn
Level 6

laugh

smarsh88
Level 3

:)

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.

Mark_Solutions
Level 6
Partner Accredited Certified

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

smarsh88
Level 3

This still doesnt seem to be putting the data into columns frown ... 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...

Mark_Solutions
Level 6
Partner Accredited Certified

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

smarsh88
Level 3

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. 

Mark_Solutions
Level 6
Partner Accredited Certified

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?

Yasuhisa_Ishika
Level 6
Partner Accredited Certified
@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!

smarsh88
Level 3

Ok, thank you. Sorry for sounding incompetent, but how do I output the results to a text file?

Never done any VBS...

Mark_Solutions
Level 6
Partner Accredited Certified

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

Marianne
Level 6
Partner    VIP    Accredited Certified

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.

Mark_Solutions
Level 6
Partner Accredited Certified

Thats a good idea Marianne!yes

Still - I do like the challenge!

Yasuhisa_Ishika
Level 6
Partner Accredited Certified
I posted batch file to create reporting in CSV format. Just download sample.txt, place it on your master server, and rename it to <desired_name>.bat. The run it from command prompt!

smarsh88
Level 3

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