KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Checking backup logfiles Arcserve and Backupexec

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
Metallator



Joined: 03 Oct 2003
Posts: 25

PostPosted: Tue Feb 03, 2004 4:33 am    Post subject: Checking backup logfiles Arcserve and Backupexec Reply with quote

Dear sirs,

I have found a way to check if your backup has been succeeded. Fortunately it works with both Arcserve and Backupexec (and maybe others, but I wasn't able to test it).

It simply makes use of the habit of both applications to dump their backuplogs in plain text-format in a special directory. For instance, for BackupExec in my situation that is: "D:\Apps\VERITAS\Backup Exec\NT\Data" The logs are called "BEXxx.txt"

The main problem was that the filename of the latest backup-report of course changed each day. So I created a batchfile which copies every BEX*.TXT to LOGFILE.TXT, orderd by date so the newest BEXxx.TXT was finally overwriting LOGFILE.TXT. This batchfile is being ran by the Backup-job in the post-commandline. Now you can simply search for a string called "Job completion status: Successful". (Remember that when the string is found, which is good, the test actually results in Bad)

I also tested the file LOGFILE.TXT to see if it wasn't older than 6 hours, which may indicate that the batchfile wasn't run and therefore the backup didn't complete at all.

My setup finally became:

Batchfile for date-sorted sequencially overwrite LOGFILE.TXT:

Code:

@Echo Off
Rem Search for .Logfiles
Dir "bex*.txt" /b /od > LogList.txt

Rem Copy every file to logfile.txt
for /F "tokens=*" %%I in (loglist.txt) do copy "%%I" logfile.txt



1st test: Check File-availability for date/time for not older than 720min (6 hours)

Code:

Method      = FileExists
;--- Common properties ---
;DestFolder = Root\TDV\Test\
RMAgent     = SWE Hoofdlocatie
Title       = SWE - Backuplog availability
Comment     = D:\Apps\VERITAS\Backup Exec\NT\Data\logfile.txt
RelatedURL  =
ScheduleMode= Regular
Schedule    =
Interval    = 600
Alerts      = Do nothing
ReverseAlert= No
UnknownIsBad= Yes
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Default
SyncCounters= Yes
SyncAlerts  = No
DependsOn   = list
MasterTest-Alive = Internetconnectie
;--- Test specific properties ---
File        = D:\Apps\VERITAS\Backup Exec\NT\Data\logfile.txt
OkIfExists  = Yes
UseMacros   = No
MaxAge      = 720


2nd test: - Check LOGFILE.TXT for string "Job completion status: Successful"
- Dependend on the 1st test

Code:

Method      = CompareFiles
;--- Common properties ---
;DestFolder = Root\TDV\Test\
RMAgent     = SWE Hoofdlocatie
Title       = SWE Backuplog Result
Comment     = alert when file contains string ("logfile.txt")
RelatedURL  =
ScheduleMode= Regular
Schedule    = 7 Days, 24 Hours
Interval    = 600
Alerts      = Do nothing
ReverseAlert= Yes
UnknownIsBad= Yes
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Default
SyncCounters= Yes
SyncAlerts  = No
DependsOn   = list
MasterTest-Alive = SWE - Backuplog availability
;--- Test specific properties ---
AlertMode   = ContainsString
MissingCheck= Yes
UseMacros1  = No
UseMacros2  = No
File1       = D:\Apps\VERITAS\Backup Exec\NT\Data\logfile.txt
String      = Job completion status: Successful
WholeWords  = No
CaseSensitive = No


It still needs some fine-tuning. Possible things to remember:
- Test only once a day
- Test only in the morning after the backup
- LOGFILE.TXT is older on monday, because in the weekend there was no backup during the weekend
and so forth

Good luck and happy testing!!
Back to top
View user's profile Send private message MSN Messenger
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Fri Oct 01, 2004 2:29 am    Post subject: Reply with quote

Hi,

Looks like a start...
The best way to determine the status of a backup is using SNMP.
You can configure Arcserve to send an SNMP trap to HM (HM server only, the RMA SNMP Trap Receiving is not yet supported)

The OID you receive is 1.3.6.1.4.1.46.877.4.0
To check if the backup was succesfull, do a compare of the Specific Value:
3 = Backup OK
2 = Backup Incomplete
1 = Backup Failed


Anyone who has different scripts ?

Pieter
Back to top
View user's profile Send private message Visit poster's website
Marcus



Joined: 18 Nov 2002
Posts: 367

PostPosted: Fri Oct 01, 2004 3:57 am    Post subject: Reply with quote

Quote:
Anyone who has different scripts ?
Don't know if this is usefull, but we did use this script to retrieve the latest file of the current day.

Code:
@echo off
rem ----------------------------------------------------------------------------
rem File   : getfile.cmd
rem Version: 1.0.0
rem Date   : 17-07-2003
rem Author : M.A. Klaver
rem Use    : Retrieve the latest file and output it with a 'type' command.
rem
rem Notes  : 1) The right file is determined in the following way:
rem                 execute: dir /OD pattern | find currentdate | find match
rem
rem                 - dir listing, sorted by date, oldest first, complying to
rem                   the pattern given.
rem                 - find in the result list, only those entries which are
rem                   modified on the current date!
rem                 - find in the result list, only those entries which contain
rem                   the match string.
rem                 - get the latest modified in the result list.
rem ----------------------------------------------------------------------------



rem ----------------------------------------------------------------------------
rem Reset global variables at start of script.
rem ----------------------------------------------------------------------------
set __FILE__=GetFile
set __VERSION__=1.0.0



rem ----------------------------------------------------------------------------
rem Setting defaults.
rem ----------------------------------------------------------------------------
set ERROR=0
set STR_INIFILE=%__FILE__%.ini
set STR_DEFAULTPATTERN=BEX*
set STR_DEFAULTDIRECTORY=c:\program files\veritas\backup exec\nt\data
set STR_DEFAULTMATCH=*



rem ----------------------------------------------------------------------------
rem Clearing values.
rem ----------------------------------------------------------------------------
set STR_LOGFILE=
set STR_DATE=
set STR_FILEPATTERN=
set STR_MATCH=
set STR_DIRECTORY=
set STR_TEMPFILE=



rem ----------------------------------------------------------------------------
rem Start script.
rem ----------------------------------------------------------------------------
call :Initialize %*
call :CreateTempFile
call :GetFileName
if {%ERROR%} GTR {0} goto ERROR_HANDLING
call :CleanUp
call :ShowLogFile
goto END



rem ----------------------------------------------------------------------------
rem Error handling.
rem ----------------------------------------------------------------------------
:ERROR_HANDLING
call :ShowError %ERROR%
call :CleanUp
goto END



rem ----------------------------------------------------------------------------
rem End of script.
rem ----------------------------------------------------------------------------
:END
goto :EOF



rem ----------------------------------------------------------------------------
rem Show the given error number on screen.
rem ----------------------------------------------------------------------------
:ShowError
    echo %__FILE__% v%__VERSION__%
    echo An error occured during the processing of this script.
    echo.
    echo Error number            = %ERROR%
    echo Pattern to use          = %STR_FILEPATTERN%
    echo Directory to search     = %STR_DIRECTORY%
    echo String match (* = none) = %STR_MATCH%
    echo Logfile found           = %STR_LOGFILE%
    echo.
    echo Error message(s):
    if {%1} == {1} echo Log file not found, create or check the %STR_INIFILE% file.
goto :EOF



rem ----------------------------------------------------------------------------
rem Initialize variables to be used by this script.
rem ----------------------------------------------------------------------------
:Initialize
    rem ------------------------------------------------------------------------
    rem Date to look for is the current date.
    rem ------------------------------------------------------------------------
    for /f "eol=; tokens=1,2* delims= " %%i in ("%DATE%") do (set STR_DATE=%%j)

    rem ------------------------------------------------------------------------
    rem Read options file if present. Set defaults for empty variables.
    rem ------------------------------------------------------------------------
    if not exist "%STR_INIFILE%" goto CHECKDEFAULTS
    for /f "eol=; tokens=1* delims=" %%i in (%STR_INIFILE%) do (call :SetOptions %%i)
    goto CHECKDEFAULTS

    :CHECKDEFAULTS
        if "%STR_FILEPATTERN%" == "" set STR_FILEPATTERN=%STR_DEFAULTPATTERN%
        if "%STR_DIRECTORY%"   == "" set STR_DIRECTORY=%STR_DEFAULTDIRECTORY%
        if "%STR_MATCH%"       == "" set STR_MATCH=%STR_DEFAULTMATCH%
goto :EOF



rem ----------------------------------------------------------------------------
rem Set options, read from the .ini file.
rem ----------------------------------------------------------------------------
:SetOptions
    :SO_START
        if /I "%1" == "" goto SO_END
        if /I "%1" == "-pattern" goto SO_SETPATTERN
        if /I "%1" == "-match" goto SO_SETMATCH
        if /I "%1" == "-directory" goto SO_SETDIRECTORY
        shift
    goto SO_START

    :SO_SETPATTERN
        if "%STR_FILEPATTERN%" == "" (set STR_FILEPATTERN=%2) else (set STR_FILEPATTERN=%STR_FILEPATTERN% %2)
        shift
        if not "%2" == "" goto SO_SETPATTERN
    goto SO_END

    :SO_SETMATCH
        if "%STR_MATCH%" == "" (set STR_MATCH=%2) else (set STR_MATCH=%STR_MATCH% %2)
        shift
        if not "%2" == "" goto SO_SETMATCH
    goto SO_END

    :SO_SETDIRECTORY
        if "%STR_DIRECTORY%" == "" (set STR_DIRECTORY=%2) else (set STR_DIRECTORY=%STR_DIRECTORY% %2)
        shift
        if not "%2" == "" goto SO_SETDIRECTORY
    goto SO_END

    :SO_END
goto :EOF



rem ----------------------------------------------------------------------------
rem Create a temporary file name.
rem ----------------------------------------------------------------------------
:CreateTempFile
    :CTF_START
        set STR_TEMPFILE=%__FILE__%.%RANDOM%.$$$
        if exist %STR_TEMPFILE% goto CTF_START
goto :EOF



rem ----------------------------------------------------------------------------
rem Retrieve the name of the file.
rem
rem The file name is selected based on:
rem     directory
rem     pattern
rem     date
rem     match
rem
rem If multiple files match the selection, the most recent changed file wil be
rem used.
rem ----------------------------------------------------------------------------
:GetFileName
    if "%STR_MATCH%" == "*" (
        dir /OD "%STR_DIRECTORY%\%STR_FILEPATTERN%" | find /I "%STR_DATE%" > %STR_TEMPFILE%
    ) else (
        dir /OD "%STR_DIRECTORY%\%STR_FILEPATTERN%" | find /I "%STR_DATE%" | find /I "%STR_MATCH%" > %STR_TEMPFILE%
    )
    for /f "eol=; tokens=1,2,3* delims= " %%i in (%STR_TEMPFILE%) do (set STR_LOGFILE=%%l)
    if "%STR_LOGFILE%" == "" set ERROR=1
goto :EOF



rem ----------------------------------------------------------------------------
rem Delete the temporary file used.
rem ----------------------------------------------------------------------------
:CleanUp
    echo Y | del %STR_TEMPFILE% >nul 2>nul
goto :EOF



rem ----------------------------------------------------------------------------
rem Now show the file found on screen.
rem ----------------------------------------------------------------------------
:ShowLogFile
    echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo  %__FILE__% v%__VERSION__%
    echo  Starting dump of log file  : %STR_LOGFILE%
    echo  Log file found in directory: %STR_DIRECTORY%
    echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    type "%STR_DIRECTORY%\%STR_LOGFILE%"
    echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo  End of dump.
    echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
goto :EOF


and the .ini file.....

Code:

;-------------------------------------------------------------------------------
; getlog.ini
;
; Lines starting with a semicolon (;) will be skipped.
; Empty lines will be skipped.
;
; This file can contain three options, each on a seperate line:
;
; -pattern
; -directory
; -match
;
; -pattern   - The pattern to use for finding the correct file. Wildcards ARE
;              permitted.
;
; -directory - The full (local) path for finding the directory where the
;              file should be found.
;
; -match     - A string, which must be a part of the filename. If not used,
;              this option wil be skipped. Wildcards are NOT allowed. Using
;              a single star (*) wil skip this option.
;
; NOTES: All options are optional.
;
;        Options and values are seperated by one(1) white space. ALL the rest of
;        the line wil be read as the value for the option.
;
;        Multiple whitespaces are converted to one(1) space
;-------------------------------------------------------------------------------
; Example:
;-pattern bex*
;-directory c:\program files\veritas\backup exec\nt\data
;-match .txt
;-------------------------------------------------------------------------------
; The above options are the same as the defaults. The script wil search for bex*
; files, located in the 'c:\program files\veritas\backup exec\nt\data' directory
; and no string match is performed on the file name.
;
Back to top
View user's profile Send private message
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Fri Oct 01, 2004 6:52 am    Post subject: Reply with quote

Hi Marcus,

thx for the code... I write my own Shell script in the meantime...

Code:
' Requires vbScript v 5.6

Dim Result, FSO, fsFolder, objArgs, item, NewestFile, NewestDate, RexEx

Result = "scriptres:BAD:Error while processing script"

On Error Resume Next
Set objArgs = WScript.Arguments
If objArgs.count<>2 Then
  wscript.stdout.write "scriptres:BAD:Unvalid number of parameters"
  wscript.quit
end if

Set regEx = New RegExp

Set FSO = CreateObject("Scripting.FileSystemObject")
If Err<>0 Then
  wscript.stdout.write "scriptres:BAD:Unable to open Filesystem Object"
  wscript.quit
end if

Set fsFolder = fso.GetFolder(objArgs(0))
If Err<>0 Then
  wscript.stdout.write "scriptres:BAD:Unable to open path"
  wscript.quit
end if

NewestFile=""
For each item in fsFolder.Files
  regEx.Pattern = objArgs(1)
  regEx.IgnoreCase = True
  If regEx.Test(Item.Name) Then
    If NewestFile="" Then Set NewestFile=Item
    If Item.DateLastModified>NewestFile.DateLastModified then Set NewestFile=Item
  End If
Next

If NewestFile="" then
  wscript.stdout.write "scriptres:BAD:No file found"
Else
  wscript.stdout.write "scriptres:OK:" & objArgs(0) & "\" & NewestFile.Name
End If


Script takes 2 parameters: "Path" "pattern"
Path is the path to be searched (eg: "\\server\c$\winnt" or "c:\temp")
pattern is a regular expression (like "J*.LOG$")
It returns the full filename of the newest file that meets the pattern.

Works cool...

Next problem:

I'm trying to use the "Text Log" test to get the results out of that file...
Unfortunatly the Filename field doesn't support MacroTranslation, only date translation...
Can this be added Alex ?

Pieter.
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Fri Oct 01, 2004 8:05 am    Post subject: Reply with quote

Discovered that Text Log is not the right test for my purpose (unfortunalty, i liked the 'return this line' as reply)
I'm using "Compare Files" now, but it looks like the 'translate macro's' is only translating date and private vars, and no testvars....

Would it be a good idea to get some line in this ?
Some tests translate them all, some don't...

Thx

Pieter
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Fri Oct 01, 2004 12:34 pm    Post subject: Reply with quote

File related test methods translate date macro variables and user defined variables (since version 4.52).
Test related variables supported by actions because different tests may execute the same action. But why do you need this macros for the test?

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Fri Oct 01, 2004 12:41 pm    Post subject: Reply with quote

I was using another test to determine the last logfile of arcserver.
Then I wanted to use that reply to be used as filename in a 'Log file' test.
I noticed that LogFile does more then just lookup a variable in a file. It also keeps track of his last position.

I wrote my own Arcserve log analyser (I might post it, when it's working 100%)

Never mind my question...

thx for the attention.

Pieter
Back to top
View user's profile Send private message Visit poster's website
Arilexed



Joined: 06 Dec 2004
Posts: 26
Location: The Lowlands

PostPosted: Fri Jan 21, 2005 2:59 am    Post subject: Reply with quote

plambrecht wrote:


Hi,

Looks like a start...
The best way to determine the status of a backup is using SNMP.
You can configure Arcserve to send an SNMP trap to HM (HM server only, the RMA SNMP Trap Receiving is not yet supported)

The OID you receive is 1.3.6.1.4.1.46.877.4.0
To check if the backup was succesfull, do a compare of the Specific Value:
3 = Backup OK
2 = Backup Incomplete
1 = Backup Failed



Could someone give me a detailed step-by-step description of how to configure the above SNMP solution to check the status of a backup?

Thnx in advance.

Regards,

Arend
Back to top
View user's profile Send private message Visit poster's website
plambrecht



Joined: 19 May 2004
Posts: 151
Location: Belgium

PostPosted: Fri Jan 21, 2005 3:56 am    Post subject: Reply with quote

Hi Arilexed,

Glad to explain this a little bit:
First of all, this works only if Arcserve can connect to the AHM server. It doesn't (yet) work with the RMA agents, as they cannot receive SNMP traps...

There are 2 things to setup :
1. Configure Arcserve to send SNMP traps to AHM Server
2. Configure AHMServer to act on the received traps.

First step:
Open your backupjob properties, and go to the Alerting tabpage.
There modify the settings, so that an SNMP trap is generated to your AHM Server.

Second step
Create a new test 'SNMP Trap'
Enter the desired info there.. I can't recall the exact settings. I do know that I set the rule for 'BAD' to Trap Type, Any Except, 3

Also, don't forget to enable the 'Alerting' service from Arcserve (Alert manager)


Pieter
Back to top
View user's profile Send private message Visit poster's website
Arilexed



Joined: 06 Dec 2004
Posts: 26
Location: The Lowlands

PostPosted: Sat Jan 22, 2005 7:38 pm    Post subject: Reply with quote

Okay, thnks pieter. Don't know all to much about MIB's and snmp. Still, my HM now fully checks the backup each day.

Cheers.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index