#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use lib "/opt/eig_linux/lib";
use BackupServer;

$ENV{'PATH'} .= ':/usr/bin:/usr/sbin';

my $bs = new BackupServer;
my $usage = $bs->get_usage;
print "Usage report:\n";
for my $key (keys %{$usage}){
    my $value = $usage->{$key};
    $key =~ s/_/ /g;
    print "$key: $value\n";
}

my $total_space = $usage->{backup_space_available} + $usage->{backup_space_used};
my $home_capacity = sprintf("%.2f", ($usage->{total_home_size}/$total_space)*100);
my $used_capacity = sprintf("%.2f", ($usage->{backup_space_used}/$total_space)*100);

print "\n";
print "Projected home spaced capacity: $home_capacity%\n";
print "Actual space used: $used_capacity%\n";
