Changeset 62


Ignore:
Timestamp:
11/11/04 16:27:28 (20 years ago)
Author:
Kris Deugau
Message:

/trunk

Updated consistency check script to check for anomalies in IP pools:

  • make sure all IPs are within a pool
  • make sure all pools are listed in allocations table
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/consistency-check.pl

    r11 r62  
    6565print " done.\n";
    6666
    67 print "Done checking master containment.\n\nChecking block-alignment consistency:\n";
     67print "Done checking master containment.\n\nChecking pool containment:\n";
     68
     69$sth = $dbh->prepare("select pool,ip from poolips order by ip");
     70$sth->execute;
     71while (@data = $sth->fetchrow_array) {
     72  $pool = new NetAddr::IP $data[0];
     73  $ip = new NetAddr::IP $data[1];
     74  print "IP $ip listed with incorrect pool $pool\n"
     75    if !$pool->contains($ip);
     76}
     77$sth = $dbh->prepare("select distinct pool from poolips order by pool");
     78$sth->execute;
     79while (@data = $sth->fetchrow_array) {
     80  $sth2 = $dbh->prepare("select cidr from allocations where cidr='$data[0]'");
     81  $sth2->execute;
     82  print "Pool $data[0] does not exist in allocations table\n"
     83    if (($sth2->fetchrow_array)[0] eq '');
     84}
     85
     86print "Done checking pool containment.\n\nChecking block-alignment consistency:\n";
    6887
    6988# Block alignment consistency:  All allocated+free blocks within a master
Note: See TracChangeset for help on using the changeset viewer.