jablonka.czprosek.czf

getonlineclouds

Subversion Repositories:
[/] [getonlineclouds.pl] - Blame information for rev 3

 

Line No. Rev Author Line
11simandl#!/usr/bin/perl
2#
3# Petr Simandl, www.simandl.cz
4#
5 
62simandl$date = `date`;
71simandlprint "Content-type: text/html\n\n";
8 
9print "<HTML><HEAD><META HTTP-EQUIV=Pragma CONTENT=no-cache></HEAD><BODY>\n";
10 
11print "Porovnani obsahu wiki <a href=\"http://czfree.net/wiki/Registrovane_cloudy\">Registrovane_cloudy</a>
122simandls aktualnima <a href=\"/cgi-bin/route.cgi\">routama</a> : $date";
131simandl 
14print "<pre>";
15 
16@gl_cloudy=`wget -q -O - http://czfree.net/wiki/Registrovane_cloudy`;
17@gl_routy=`ip ro ls | grep ^10 `;
18 
192simandl$gl_pocetonline = 0;
20$gl_pocetzastupcu = 0;
21$gl_pocethlasu = 0;
22$gl_pocetofflinehlasu = 0;
231simandl 
24foreach $gl_line (@gl_cloudy)
25{
26 if ($gl_line =~ /^\<td\> AS6/)
27 {#print "$gl_pole[4] $gl_pole[5]\n";
28 $gl_line =~ s/<td> //;
29 $gl_line =~ s/<\/td><td>/\t/g;
30 
31 @gl_pole=split("\t",$gl_line);
32 $gl_as = $gl_pole[0];
33 $gl_as =~ s/ //g;
34 $gl_rozsah = $gl_pole[1];
35 $gl_rozsah =~ s/ //g;
36 @gl_rozsah=split("a",$gl_rozsah);
37 
38 $gl_zastupce = $gl_pole[2];
392simandl $gl_zastupce =~ s/ //g;
401simandl $gl_udaje = $gl_pole[3];
41 $gl_online = $gl_pole[4];
422simandl $gl_online =~ s/\n//g;
43 $gl_online =~ s/ //g;
44 $gl_hlas = $gl_pole[5];
45 $gl_hlas =~ s/\n//g;
46 $gl_hlas =~ s/ //g;
471simandl $gl_pritomno = 0;
48 $gl_podobne = "";
493simandl $gl_ping = $gl_rozsah[0];
50 $gl_ping =~ s/\//xx/g;
51 $gl_bgp = $gl_as;
52 $gl_bgp =~ s/AS//g;
531simandl 
542simandl if ("$gl_hlas" eq "ano") {$gl_pocethlasu += 1};
55 if ("$gl_online" eq "ano") {$gl_pocetonline += 1};
56 if ("$gl_zastupce" ne "ne") {$gl_pocetzastupcu += 1};
57 
583simandl print "<a href=\"http://ripe.czfree.net/index.php?action=object.search&paramvalue=$gl_rozsah\">$gl_as</a> (historie ";
59 print "<a href=\"http://sitelka.jablonka.cz/hotsanic/bgp/$gl_bgp.html\">bgp</a> ";
60 print "<a href=\"http://sitelka.jablonka.cz/hotsanic/ping/$gl_ping.html\">pingu</a>) ma mit $gl_rozsah a nalezeno: ";
611simandl 
62 foreach $gl_routa (@gl_rozsah)
63 {
64 foreach $gl_iprouta (@gl_routy)
65 {
66 @gl_linka=split(" ",$gl_iprouta);
67 if ("$gl_linka[0]" eq "$gl_routa")
68 {
69 $gl_pritomno += 1;
70 print "$gl_routa ";
71 } else {
72 @gl_ipnum=split("\\.",$gl_linka[0]);
73 @gl_ronum=split("\\.",$gl_routa);
74 if ("$gl_ipnum[1]" eq "$gl_ronum[1]")
75 {
76 $gl_podobne .= "<a href=\"http://ripe.czfree.net/index.php?action=object.search&paramvalue=$gl_linka[0]\">$gl_linka[0]</a> ";
77 }
78 }
79 }
80 }
81 if ($gl_pritomno == 0)
822simandl { print "nic\t";
831simandl }
84 if ($gl_podobne)
85 {
86 print "\tpodobne routy: $gl_podobne ";
87 }
882simandl if (("$gl_hlas" eq "ano") && ($gl_pritomno == 0) && !($gl_podobne))
89 {
90 print " <blink>!</blink>$gl_zastupce<blink>!</blink> $gl_online $gl_hlas \n";
91 $gl_pocetofflinehlasu += 1;
92 } else {
93 print " $gl_zastupce $gl_online $gl_hlas \n";
941simandl }
952simandl }
961simandl}
97 
982simandlprint "Shrnuti wiki:\n";
99print "Pocet zastupcu : $gl_pocetzastupcu\n";
100print "Pocet online : $gl_pocetonline\n";
101print "Pocet zastupcu s hlasovacim pravem : $gl_pocethlasu\n";
102print "Pocet zastupcu kteri prave ted maji sit offline : $gl_pocetofflinehlasu\n";
1031simandlprint "</pre></body></html>";

Powered by WebSVN 2.2.1