1 #!/bin/env /usr/local/bin/perl
2 ################################################################################
6 # Description: Monitor filesystem growth
8 # Author: Andrew@ClearSCM.com
9 # Created: Thu Dec 11 10:39:12 MST 2008
13 # (c) Copyright 2008, ClearSCM, Inc., all rights reserved.
15 #################################################################################
21 use Net::Domain qw(hostname);
23 use lib ($FindBin::Bin, "/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/lib");
30 # This is a non-standard, but commonly used prompt around here. For
31 # EAST systems they use a terminator of "]$" as in "[p6258c@ceast1
32 # p6258c]$ " however on ranray it's more like "[ranray/home/pwit]
33 # ". So we look for both.
34 use constant PROMPT => qr'(\]\$|\] $)';
41 my $usage = "ERROR: $msg\n\n" if $msg;
44 Usage: $FindBin::Script\t[-us|age] [-v|erbose] [-d|ebug]
46 -us|age: Display usage
47 -ve|rbose: Turn on verbose mode
48 -d|ebug: Turn on debug mode
51 my $pager = $ENV{PAGER} ? $ENV{PAGER} : "more";
53 system "echo \"$usage\" | $pager";
62 verbose => sub { set_verbose },
63 debug => sub { set_debug },
64 usage => sub { usage; exit 0 },
68 my $fsmondb = new FsmonDB ("fsmonadm", "fsmonadm");
70 # Take a snapshot of all systems
71 verbose "Taking snapshots...";
73 foreach ($fsmondb->getSystem) {
74 verbose "Snapshotting $_";
76 # my ($errno, $errmsg) = $fsmondb->snapshot ($_, PROMPT);
77 my ($errno, $errmsg) = $fsmondb->snapshot ($_);
79 warning "Unable to take snapshot of $_\n$errmsg"