-#!/usr/local/bin/perl
+#!/usr/bin/perl
use strict;
use lib "__INSTALLDIR__/lib";
my $workbook = Spreadsheet::WriteExcel->new($xls_file) || die "can't write to $xls_file: $!";
my @cols = qw(
+hostname
type
num
startTime
endTime
-=D##-C##,duration
+=E##-D##,duration
level
noFill
fillFromNum
compress
sizeNewComp
-=V##/S##,sizeNewRatio
+=W##/T##,sizeNewRatio
sizeExistComp
-=X##/T##,sizeExistRatio
+=Y##/U##,sizeExistRatio
);
my $date_format = $workbook->add_format(num_format => 'yyyy-mm-dd hh:mm:ss');
my $hosts = $bpc->HostInfoRead();
+my $worksheet = $workbook->add_worksheet('BackupPC');
+my $row = 0;
+
+my $i = 0;
+# insert sheet header (with formatting)
+foreach my $c (@cols) {
+ if ($c =~ m/^=.*,(.+)/) {
+ $worksheet->write($row, $i++, $1, $header_format);
+ } else {
+ $worksheet->write($row, $i++, $c, $header_format);
+ }
+}
+$row++;
+
foreach my $host_key (sort keys %{$hosts}) {
my $hostname = $hosts->{$host_key}->{'host'} || die "can't find host for $host_key";
print $hostname, " ";
- my $worksheet = $workbook->add_worksheet($hostname);
-
# get backups for a host
my @backups = $bpc->BackupInfoRead($hostname);
print scalar @backups, " increments\n";
- my $row = 0;
my $i = 0;
-
- foreach my $c (@cols) {
- if ($c =~ m/^=.*,(.+)/) {
- $worksheet->write($row, $i++, $1, $header_format);
- } else {
- $worksheet->write($row, $i++, $c, $header_format);
- }
- }
- $row++;
+ $worksheet->write($row, $i++, $hostname);
foreach my $backup (@backups) {
for (my $i = 0; $i <= $#cols; $i++) {
=item File::Pid
+=item Spreadsheet::WriteExcel
+
=back
+Last module, C<Spreadsheet::WriteExcel> is needed only if you want to use
+C<BackupPC_xls_report> to generate Excel reports from your backup data.
+
Easiest way to install them is using C<cpan> shell.
- $ sudo cpan File::Pid
+ $ sudo cpan File::Pid Spreadsheet::WriteExcel
=head1 Creation of initial database
Now that you finished installation, you can select new options from
menu on the left and example search and archival.
+=head1 Reporting in Excel
+
+Often, it is useful to be able to present report about your BackupPC hosts, number
+of snapshots, total size and other useful info. While all those information can
+be accessed using web browser, for analysis it's useful to have them in spreadsheet
+form. With this data, you can monitor changes on your backup cycle, effects of changes
+on your server or network to your BackupPC installation and so on.
+
+You can create Excel spreadsheet (which works perfectly with Gnumeric also) using
+following command:
+
+ $ sudo -u backuppc /data/backuppc/bin/BackupPC_xls_report
+
=head1 Related projects
BackupPC allready has archival host which might suit your needs better (and