Formatting Reports

From wiki.zmanda.com
Jump to navigation Jump to search

mysql-zrm-reporter report format can be controlled by specifying format in /etc/mysql-zrm/mysql-zrm-reporter.conf. The configuration file - mysql-zrm-reporter.conf allows user to specify the format for each backup parameter. User can specify the size of each parameter value, alignment and date format in the backup reports. The configuration file is used for predefined reports as well as custom reports generated by the user. Each line in the file is for a specific backup run parameter. The syntax for each line is

fieldname=width,alignment[,format]
width
the number of characters for the value. If the value exceeds the number of characters specified, the value will wrap around into multiple lines
alignment
values can be left("<") or right(">") aligned. Value ("|") means the value is aligned in the center. Center alignment only works on HTML reports.
format
The format parameter is available only for backup-date parameter. The format syntax is same as FORMAT syntax for Unix date(1) command. For example: "%F %T" format would display "2006-09-19 15:47:37"

For example: Backup status report with backup-date format "%c". The mysql-zrm-reporter.conf should have the following entry:

 backup-date = 25,<,%c

The backup-date column will have 25 characters width, left aligned in the column and format will be %c. The backup report for this backup-date format is:

 # mysql-zrm-reporter -where backup-set=backupSet1
 backup_set  backup_date              backup_level  backup_status        backup_directory
 ----------------------------------------------------------------------------------------
 backupSet1  Tue 29 Aug 2006                     0  Backup succeeded      /var/lib/mysql-zrm/backupSet1/
             02:08:03 PM PDT                                              20060829140803
 backupSet1  Tue 29 Aug 2006                     0  Backup succeeded      /var/lib/mysql-zrm/backupSet1/
             02:09:33 PM PDT                                              20060829140933

HTML report

mysql-zrm-reporter can format backup run reports in HTML and put them in a directory under the webserver document root location (use --output option of mysql-zrm-reporter). This makes them accessible via web. Prevent unauthorized access using a web browser by appropriate access controls to the backup html directory.


Example: Creating backup status html report for backup set BackupSet2

# mysql-zrm-reporter --show backup-status-info --where backup-set=backupSet2 \
  --type html --output /var/www/html/backup-reports/backup-status-backupSet2

Example: Backup status HTML output

<html> <head> <title>Z R M B A C K U P R E P O R T</title> <link rel="stylesheet" href="css/default.css"> </head> <body>

backup_set backup_date backup_level backup_status comment
backupSet2 2006-08-29 14:07:23 0 Backup done but with errors ----
backupSet2 2006-08-29 14:08:19 0 Backup succeeded ----
backupSet2 2006-08-29 14:10:01 0 Backup succeeded ----
backupSet2 2006-08-29 17:45:14 0 Backup succeeded ----
backupSet2 2006-08-29 17:46:16 0 Backup succeeded ----
backupSet2 2006-08-29 17:48:04 0 Backup succeeded ----

</body> </html>