Changeset 1751

Show
Ignore:
Timestamp:
12/03/08 10:13:29 (1 month ago)
Author:
ton
Message:

Add migration flag

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/DEV-opsview3/opsview-core/installer/migrate_rrds

    r1748 r1751  
    3737use XML::LibXML; 
    3838 
     39# Cache all hostnames and servicenames for faster checking later 
    3940my $hostnames = {}; 
    4041my $it = Opsview::Host->retrieve_all; 
     
    5758my @files = grep /\.rrd$/, readdir D; 
    5859closedir D; 
     60 
     61my $rrd_migration_flag = "/usr/local/nagios/var/rrd_migration.flag"; 
     62open F, "> $rrd_migration_flag" or die "Cannot create migration flag"; 
     63close F; 
    5964 
    6065foreach my $file (@files) { 
     
    7984                } 
    8085        } 
    81         if ($found) { 
    82                 print "hostname=$hostname, servicename=$servicename, db=$db\n"; 
    83         } else { 
     86        unless ($found) { 
    8487                print "ERROR: $file - cannot match to a hostname or servicename\n"; 
    8588                next; 
    8689        } 
     90 
     91        my $time = scalar localtime; 
     92        print "$time: hostname=$hostname, servicename=$servicename, db=$db\n"; 
    8793 
    8894        # Dump the rrd, save to file 
     
    220226                } 
    221227 
    222                 # Delete the original rrd 
    223         } 
    224 
     228                print "Created $metric - $rrdname\n"; 
     229        } 
     230 
     231        # Delete the original rrd 
     232        unlink "$rrddir/$file"; 
     233        print "...done\n"; 
     234
     235 
     236unlink $rrd_migration_flag; 
    225237 
    226238# From insert.pl