jablonka.czprosek.czf

getonlineclouds

Subversion Repositories:
[/] [getonlineclouds.pl] - Rev 4

Compare with Previous - Blame - Download


#!/usr/bin/perl
#
# Petr Simandl, www.simandl.cz
#

$date = `date`;
print "Content-type: text/html\n\n";

print "<HTML><HEAD><META HTTP-EQUIV=Pragma CONTENT=no-cache></HEAD><BODY>\n";

print "Porovnani obsahu wiki <a href=\"http://czfree.net/wiki/Registrovane_cloudy\">Registrovane_cloudy</a>
s aktualnima <a href=\"/cgi-bin/route.cgi\">routama</a> : $date";

print "<pre>\n";
print "<b>AS       Grafy s historii    rozsahy z wiki         rozsahy online         Zastupce Online Hlasuje</b>\n";

@gl_cloudy=`wget -q -O - http://czfree.net/wiki/Registrovane_cloudy`;
@gl_routy=`ip ro ls | grep ^10 `;

$gl_pocetonline = 0;
$gl_pocetzastupcu = 0;
$gl_pocethlasu = 0;
$gl_pocetofflinehlasu = 0;

foreach $gl_line (@gl_cloudy)
{
  if ($gl_line =~ /^\<td\> AS6/)
  {#print "$gl_pole[4] $gl_pole[5]\n";
  $gl_line =~ s/<td> //;
  $gl_line =~ s/<\/td><td>/\t/g;

  @gl_pole=split("\t",$gl_line);
  $gl_as = $gl_pole[0];
  $gl_as =~ s/ //g;
  $gl_rozsah = $gl_pole[1];
  $gl_rozsah =~ s/ //g;
  @gl_rozsah=split("a",$gl_rozsah);

  $gl_zastupce = $gl_pole[2];
  $gl_zastupce =~ s/ //g;
  $gl_udaje = $gl_pole[3];
  $gl_online = $gl_pole[4];
  $gl_online =~ s/\n//g;
  $gl_online =~ s/ //g;
  $gl_hlas = $gl_pole[5];
  $gl_hlas =~ s/\n//g;
  $gl_hlas =~ s/ //g;
  $gl_pritomno = 0;
  $gl_podobne = "";
  $gl_ping = $gl_rozsah[0];
  $gl_ping =~ s/\//xx/g;
  $gl_bgp = $gl_as;
  $gl_bgp =~ s/AS//g;

  if ("$gl_hlas" eq "ano") {$gl_pocethlasu += 1};
  if ("$gl_online" eq "ano") {$gl_pocetonline += 1};
  if ("$gl_zastupce" ne "ne") {$gl_pocetzastupcu += 1};

  print "<a href=\"http://ripe.czfree.net/index.php?action=object.search&paramvalue=$gl_rozsah\">$gl_as</a> (historie ";
  print "<a href=\"http://sitelka.jablonka.cz/hotsanic/bgp/$gl_bgp.html\">bgp</a> ";
  print "<a href=\"http://sitelka.jablonka.cz/hotsanic/ping/$gl_ping.html\">pingu</a>) ma mit $gl_rozsah a nalezeno: ";

  foreach $gl_routa (@gl_rozsah)
  {
    foreach $gl_iprouta (@gl_routy)
    {   
     @gl_linka=split(" ",$gl_iprouta);
      if ("$gl_linka[0]" eq "$gl_routa")
          { 
      $gl_pritomno += 1;
      print "$gl_routa ";
          } else {
            @gl_ipnum=split("\\.",$gl_linka[0]);
            @gl_ronum=split("\\.",$gl_routa);
            if ("$gl_ipnum[1]" eq "$gl_ronum[1]")
            {
             $gl_podobne .= "<a href=\"http://ripe.czfree.net/index.php?action=object.search&paramvalue=$gl_linka[0]\">$gl_linka[0]</a> ";
            }
          }
    }
  }
  if ($gl_pritomno == 0)
  { print "nic\t";
  }
  if ($gl_podobne)
  {
  print "\tpodobne routy: $gl_podobne ";
  }
  if (("$gl_hlas" eq "ano") && ($gl_pritomno == 0) && !($gl_podobne))
  { 
    print " <blink>!</blink>$gl_zastupce<blink>!</blink> $gl_online $gl_hlas \n";
    $gl_pocetofflinehlasu += 1;
  } else {
    print " $gl_zastupce $gl_online $gl_hlas \n";
  }
  }
}

print "Shrnuti wiki:\n";
print "Pocet zastupcu : $gl_pocetzastupcu\n";
print "Pocet online : $gl_pocetonline\n";
print "Pocet zastupcu s hlasovacim pravem : $gl_pocethlasu\n";
print "Pocet zastupcu kteri prave ted maji sit offline : $gl_pocetofflinehlasu\n";
print "</pre></body></html>";

Powered by WebSVN 2.2.1