![]() |
Languages »
C# »
Utilities
Intermediate
License: The Code Project Open License (CPOL)
Zeta Backup ValidatorBy Uwe KeimA small console application that helps you in verifying whether your backups succeed by checking files and folders with various configurable rules |
C#, .NET (.NET3.5), SQL-Server (SQL2005, SQL2008), Dev, SysAdmin
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Zeta Backup Validator (ZBV) is a small .NET 3.5 console application that helps you in verifying whether your backups succeed by checking files and folders with various configurable rules (folder size, file age, etc.).
We developed ZBV to enable us to verify the successful creation of backups from various sources in a more reliable and automated way.
We fetch daily backups from our web servers, from local PCs, from servers in the LAN, from databases, you name it. Usually, we took some minutes/hours in the morning, looked at the folders and the files and decided whether the backups ran successfully.
To save us time, we developed ZBV that saves us from looking at the files. What ZBV does is look at folders and files and check them against several configurable rules. If a rule fails, the administrators will get an error e-mail message, if all rules succeed, the administrator will get a success notification e-mail message.
ZBV allows for automated checking of folders and files to previously defined rules. When a rule results in success or in failure, an e-mail message is generated. The subject and content of the e-mail message can be configured, by yourself.
The rules are defined in an easy-to-understand configuration file. Currently the following rules are available:
Although we are using ZBV on a daily basis, there is still room for improvements:
Usually you configure one or multiple scheduled tasks in the Windows Task Scheduler that fired one or multiple calls to ZBV.
E.g. you can configure a scheduled task to run on a daily basis to check your backup files. Be sure to execute the scheduled tasks after your backups are performed.
To actually call ZBV, call the "zbv.exe" application.
The rules configuration file to process can be passed to "zbv.exe" either by specifying it in the application configuration file "zbc.exe.config" in the "appSettings" section with the key "configurationFilePath" or by passing the configuration file as the first command line argument in the command line. In both modes, you can use path placeholders.
So a valid command line would look like:
"c:\program files\zbv\zbv.exe" "$(SpecialFolder.ExecutingAssembly)\my-server.xml"
The placeholder "$(SpecialFolder.ExecutingAssembly)" in the example would be expanded to the folder path of the executable, i.e. "c:\program files\zbv\zbv.exe".
This chapter explains which elements you have to configure before you can use ZBV successfully. Although the chapter outlines several important items to configure, it does not go into every detail.
The best way to learn is to first read the manual and then take a look at the example files.
The application configuration file exists once. Open it with any (XML) text editor (e.g. Notepad or another text editor like "Notepad++" - but not with e.g. Wordpad or Microsoft Office Word, since the content will be rendered unusable).
Please examine the shipped application configuration file for details.
Specify the mail sender and receivers and the e-mail subject as well as the templates to use in the "appSettings" section.
See the "appSettings" documentation for a complete syntax on how to use it.
Specify how and whether to log low level events. The defaults are to log to a text file (change the path to fit your requirements) and to the console window.
See the log4net website for a complete documentation on how to configure logging.
In order to successfully send out e-mail messages, ZBV needs to know the SMTP server to use. Specify all SMTP related settings, including authentication settings, in the "mailSettings" section.
See the "mailSettings" documentation for a complete syntax on how to use it.
You can create any number of XML configuration files. The download of ZBV ships with an example configuration file "zbv-config.xml" that you can open with any (XML) text editor (e.g. Notepad or another text editor like "Notepad++" - but not with e.g. Wordpad or Microsoft Office Word, since the content will be rendered unusable).
Typically you define one configuration file per server to check.
An excerpt from a configuration file looks like the following:
<ValidationDirectory Name="Exchange Server" Path="\\my-server\Backup\Exchange">
<ValidationMethods>
<ValidationMethod Type="MaxAge" Domain="SingleFile"
DomainName="ExchangeBackup.bkf" Value="24"
SignificanceLevel="ErrorLevel" />
<ValidationMethod Type="MinSize" Domain="SingleFile"
DomainName="ExchangeBackup.bkf" Value="10000000000"
SignificanceLevel="WarningLevel" />
</ValidationMethods>
</ValidationDirectory>
You can enter multiple "ValidationDirectory" nodes per configuration file. Each node contains one or multiple validation methods (i.e. the "rules") to execute.
The following attributes exist:
MaxAge - Checking the age of the oldest file in a folder or the age of a directly specified file. MinSize - Checking the size of a file or a folder. Directory - If type is "MaxAge" the specified folder and all child folders are being checked for the oldest file. If type is "MinSize" the size of the folder (i.e. the sum of the sizes of all contained files) is checked. NewestFile - The newest file in a specified folder and all child folders. OldestFile - If type is "MaxAge", this option checks for the oldest file in the specified folder. If type is "MinSize" the oldest file in the folder is checked for its size. SingleFile - A single file. The file name is entered in the "DomainName" attribute. FileGroup - A wildcard for a group of files like e.g. "*.txt". The wildcard itself is entered in the "DomainName" attribute. MaxAge - The number of hours that specifies the maximum allowed age of a file or the oldest file in a folder. MinSize - The minimum file size in bytes. Here you specify how to treat rule failures.
WarningLevel - Report failure as warning. ErrorLevel - Report failure as error. For all rules in one rule XML file, one single e-mail message is generated and sent out. By using e-mail template files, you can configure the layout and format of the generated e-mail messages.
The templates must be specified in the application configuration file to point to the correct files (see above).
The following template files exist:
Each HTML file contains various placeholders that will be expanded upon actual sending of a notification e-mail message. You can edit the HTML files with any (HTML) text editor like e.g. Notepad, Microsoft Expression Web or Adobe Dreamweaver.
A template fragment is being used for each error or warning that occurs during a rule check. The fragment is inserted one or multiple times into the main envelope HTML e-mail message before sending.
If you have errors during installation or configuration, check the following items:
In this article, I've introduced a small application to enhance the quality of your backups by helping you check the backups for certain rules.
When voting, please notice that I put my article in the "Utilities" section, so I assume it is safe to not post any source code explanations in the article itself. Thanks.
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 16 Nov 2009 Editor: Deeksha Shenoy |
Copyright 2009 by Uwe Keim Everything else Copyright © CodeProject, 1999-2010 Web18 | Advertise on the Code Project |