Re: amoverview with vaulted dumps
Orion Poplawski <[email protected]>
| Newsgroups | gmane.comp.archivers.amanda.devel |
|---|---|
| Message-ID | <[email protected]> |
On 05/17/2016 02:54 PM, Orion Poplawski wrote: > My amoverview output has become quite unwieldy with the inclusion of vaulted > dumps. I'd like to be able to limit it to certain labels to select between > normal and vaulted dumps. > > Currently amoverview uses Amanda::DB::Catalog::get_dumps() to return the set > of dumps to process. Dumps are not associated with labels, parts are. So, > any thoughts as to the best way to proceed with selecting for labels that > match a pattern? > This is what I've managed to come up with based on 3.3.9. It's not ideal, but seems to basically work. We miss information on failed dumps though. -- Orion Poplawski Technical Manager 303-415-9701 x222 NWRA, Boulder/CoRA Office FAX: 303-415-9702 3380 Mitchell Lane [email protected] Boulder, CO 80301 http://www.nwra.com
amoverview.patch
(text/x-patch, 1.7 KB)
--- /usr/sbin/amoverview 2016-08-16 11:02:50.000000000 -0600
+++ amoverview 2016-11-07 13:48:55.612006738 -0700
@@ -33,7 +33,8 @@
sub Usage {
print STDERR <<END;
Usage: $0 [--hostwidth width] [--diskwidth width] [--skipmissed]
- [--last] [--num0] [--togo0] [--verbose] [--config] <config>
+ [--last] [--num0] [--togo0] [--verbose] [--labelstr labelstr ]
+ [--config] <config>
This script generates to standard output an overview of the filesystems
dumped over time and the type of dump done on a particular day, such as
@@ -54,6 +55,7 @@
my $opt_last = 0;
my $opt_num0 = 0;
my $opt_togo0 = 0;
+my $opt_labelstr = undef;
my $opt_verbose = 0;
GetOptions('version' => \$opt_version,
@@ -64,6 +66,7 @@
'last' => \$opt_last,
'num0' => \$opt_num0,
'togo0' => \$opt_togo0,
+ 'labelstr=s' => \$opt_labelstr,
'verbose' => \$opt_verbose)
or Usage();
@@ -103,9 +106,19 @@
my %dates = ();
my %level = ();
my ($date, $host, $disk);
+my @dumps = ();
$opt_verbose and
print STDERR "Processing $opt_config dumps\n";
-foreach my $dump (Amanda::DB::Catalog::sort_dumps(['hostname','diskname','write_timestamp'],Amanda::DB::Catalog::get_dumps())) {
+if (defined($opt_labelstr)) {
+ my %parameters = ();
+ $parameters{"labelstr"} = $opt_labelstr if defined($opt_labelstr);
+ foreach my $part (Amanda::DB::Catalog::get_parts(%parameters)) {
+ push(@dumps,$part->{"dump"});
+ }
+} else {
+ @dumps = Amanda::DB::Catalog::get_dumps();
+}
+foreach my $dump (Amanda::DB::Catalog::sort_dumps(['hostname','diskname','write_timestamp'],@dumps)) {
$host = $dump->{"hostname"};
$disk = $dump->{"diskname"};
$date = substr($dump->{"dump_timestamp"},0,8);