<<< Chronological >>> Author Index    Subject Index <<< Threads >>>

Re: [myastesting] Cool tool!


Hi Artem,

see answers bellow.

On Mon, Apr 21, 2003 at 08:04:44PM +0300, Artem Naluzhny wrote:
> Hello!
> 
> 1. That's my current config:
> ---<begin>---
> Transit Provider
> Providers Holddown time Holddown event Time to live
> 25228     3600          5              14400
> 3261      3600          5              14400
> 6849      3600          5              14400
> ----<end>----
> 
> Today in the morning I have added AS25228 and AS3261, but alarms have not 
> disappeared yet (all are red):
> ---<begin>---
> Transit provider alarm
> 193.41.50.0/24 - 3261 - 1 - Wed Mar 12 12:00:33 2003
> 193.41.49.0/24 - 3261 - 1 - Wed Mar 12 12:00:33 2003
> 193.178.250.0/24 - 25228 - 1 - Wed Mar 12 12:43:47 2003
> 193.41.51.0/24 - 3261 - 1 - Wed Mar 12 12:00:33 2003
> 193.178.251.0/24 - 25228 - 1 - Wed Mar 12 12:43:47 2003
> 80.249.224.0/20 - 25228 - 1 - Wed Mar 12 11:34:57 2003
> 194.29.205.0/24 - 3261 - 1 - Wed Mar 12 13:09:46 2003
> 193.41.48.0/24 - 3261 - 1 - Wed Mar 12 12:00:33 2003
> 193.178.248.0/24 - 25228 - 1 - Wed Mar 12 12:43:47 2003
> ----<end>----
> 
> Why?
because the changes you made in your alarm configuration don't affect
existing alarm events. However if after changing the config the same
alarm events still appear there's a bug. I will have a look into it as 
the times your alarm events were generated look pretty suspicious. 12
march was a long time ago :)    


 
> 
> 2. Can you explain MyAS operation as the flowchart.
> 
    --------------
   | RIS raw data |
    --------------
       |
       |
       |     --------------                  -----
       |--->| myAS backend | <------------> | GUI |                 
             --------------                  ----- 
                   |
                   |------> Alarm messages  


Roughly: myAS backend scans RIS raw data. It matches bgp messages from raw
         data againts User confuguration obtained from GUI. When alarm events 
         are triggered: config files on GUI are updated(alaways) and alarm 
         messages sent(when required by User).

FYI: we're now working on a new version with a new 'flowchart', new GUI(graphical
user interface), new functions and more processing power(real time data processing from
all RRC's).  
    

> 3. Is CGI source code public avaible? I have some ideas on improvement of 
> user interface.

Nice! I attached the code to this message. 
  

Regards,

Maximo.


> 
> 
> -- 
> Artem Naluzhny artem@localhost
> network engineer of TeleportSV, Kharkov, Ukraine
> tel/fax: +380 572 142357, +380 572 405504
#!/usr/local/bin/perl -w
#
#
# Copyright (c) 2000, 2001  RIPE NCC
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of the author not be
# used in advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
#
# THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
# AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
#------------------------------------------------------------------------------
# Module Header
# Filename          :   alarmstatus.cgi
# Purpose           :   frontend for myAS prototype 
# Authors           :   Maximo AlvesRIPE NCC
# Date              :   20-Dec-2002
# Language Version  :   perl5
# TODO              :   
#------------------------------------------------------------------------


use strict;

my $ALARMINGFILE = "/export/risfsa13/www/cgi/myas/accounts/xxx/myas.alarming.db";
my $CONFIGFILE = "/export/risfsa13/www/cgi-bin/myas/accounts/xxx/myas.alarm.config";
my $DEBUG = 0;
my $debug = "";
my @alarms = ();
my %fields = {};
my $obgpmessage = "";
my $tbgpmessage = "";
my $cbgpmessage = "";
my $writepermit = 0;
my $loggeduser = "";
my $as = "";
my @origin = (); #hold origin alarm config
my @provider = (); #hold provider alarm config
my @customer = (); #hold customer alarm config 
my @users = (); #hold account users config


#### Read query string from browser
my $buffer = $ENV{'QUERY_STRING'};

$_ = $buffer;

s/%2F/\//g;
s/%2C/,/g;
s/%2B/+/g;
s/%3A/:/g;

$buffer = $_;
my @input_line = split (/&/, $buffer);
foreach my $entry (@input_line) {
  my ($head, $tail) = split(/=/, $entry);
  $fields{$head} = $tail;
}

&read_config_file;
&login_manager;
&read_alarming_file;

#manage user action

if($fields{'action'}=~/CLOSEUP_ORIGIN/){
    my $index = $fields{'originalarms'};
    my $auxstr = $alarms[$index];
    $obgpmessage = (split(/ - /,$auxstr))[5];
}

if($fields{'action'}=~/CLOSEUP_TRANSIT/){
    my $index = $fields{'originalarms'};
    my $auxstr = $alarms[$index];
    $tbgpmessage = (split(/ - /,$auxstr))[5];
}
if($fields{'action'}=~/CLOSEUP_CUSTOMER/){
    my $index = $fields{'originalarms'};
    my $auxstr = $alarms[$index];
    $cbgpmessage = (split(/ - /,$auxstr))[5];
}



#### HTML printing starts here
	
print "Content-Type: text/html\n\n";
	
print <<EOF;

<HTML>
<HEAD>
<TITLE>Alarm status</TITLE>
</HEAD>
<BODY BGCOLOR=BLUE>
   <TABLE BGCOLOR=WHITE BORDER=0 CELLSPACING=0 CELLPADING=0 ALIGN=CENTER WIDTH="80%" height="100%">
      <TR ALIGN=CENTER>
        <TD HEIGHT=70>
            <TABLE BORDER=0 CELLSPACING=0 CELLPADING=0 WIDTH="80%" height=60 >
              <TR>
                 <TD ALIGN=LEFT  HEIGHT=60 WIDTH="15%"> 
                    <img ID="Banner4" HEIGHT=60 WIDTH=60 SRC="http://www.ris.ripe.net/myas/assets/images/ncclogo-small.gif"; BORDER=0 ALT="ripe logo" NOF=B_H> 
                 </TD>                 
                 <TD ALIGN=CENTER HEIGHT=60 WIDTH="70%"> 
                    <img ID="Banner4" HEIGHT=60 WIDTH=580 SRC="http://www.ris.ripe.net/myas/assets/images/Current_Alarms_NBanner.gif"; BORDER=0 ALT="Current Alarms" NOF=B_H>  
                 </TD>
                 <TD ALIGN=LEFT  HEIGHT=60 WIDTH="15%"> 
                
                 </TD> 
               </TR>
            </TABLE>       
        </TD>
      </TR>
      <TR ALIGN=CENTER>
         <TD HEIGHT=70>
             <A HREF="http://www.ris.ripe.net/cgi-bin/myas/index.cgi";><IMG ID="NavigationButton1" HEIGHT=21 WIDTH=129 SRC="http://www.ris.ripe.net/myas/assets/images/myAS_-_home_Np1.gif"; BORDER=0 ALT="myAS - home"></A>
             <A HREF="http://www.ris.ripe.net/cgi-bin/myas/accounts/xxx/alarmstatus.cgi";><IMG ID="NavigationButton1" HEIGHT=21 WIDTH=129 SRC="http://www.ris.ripe.net/myas/assets/images/Current_Alarms_Hp3.gif"; BORDER=0 ALT="myAS - Current Alarms"></A>
             <A HREF="http://www.ris.ripe.net/cgi-bin/myas/accounts/xxx/alarmconfiguration.cgi";><IMG ID="NavigationButton1" HEIGHT=21 WIDTH=129 SRC="http://www.ris.ripe.net/myas/assets/images/Alarm_Configuration_Np1.gif"; BORDER=0 ALT="myAS - Alarm Configuration"></A>
             <A HREF="http://www.ris.ripe.net/myas/accounts/xxx/myashelp.html";><IMG ID="NavigationButton1" HEIGHT=21 WIDTH=129 SRC="http://www.ris.ripe.net/myas/assets/images/myAS_-_Help_Np1.gif"; BORDER=0 ALT="myAS - help"></A>
         </TD>
      </TR>
     
      <TR>
         <TD HEIGHT=10 > <hr> </TD>
      </TR>


EOF


print <<EOF2;


     <TR  ALIGN=CENTER>
         <TD HEIGHT=130 >
            <TABLE BORDER=0 CELLSPACING=0 CELLPADING=0 WIDTH="80%" height=60 >
              <TR>
                <TD HEIGHT=130 WIDTH="50%">
                   <P><FONT COLOR="#0033CC"  SIZE=" +1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
                     Account: $as<br> 
    	             User: $loggeduser <br>
                     <A HREF="http://www.ris.ripe.net/cgi-bin/myas/index.cgi";>Log Out </A>  
                   </FONT></P>        
                </TD>
                <TD HEIGHT=130 WIDTH="70%">
                   <P><FONT COLOR="#0033CC"  SIZE="2" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif"> 
                     HELP INFO:<br>
                     You might select one alarm event and click on CLOSE UP to see the details<br>
                     Red alarms are active<br>
                     Black alarms are no longer active due to a withdraw message or because time has expired<br>
                     Windows explorer users note that all alarm events are black and * shows non active alarms<br>  
                     </FONT></P>
                </TD>
              </TR> 
            </TABLE>        
         </TD>
      </TR>
      <TR>
         <TD HEIGHT=10 > <hr> </TD>
      </TR>
     <TR  ALIGN=CENTER> 
         <TD HEIGHT=10> <B><FONT COLOR="#0033CC" SIZE="4" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
         Origin alarm 
  
         </FONT></B>  </TD>
      </TR>
      <TR  ALIGN=CENTER> 
         <TD HEIGHT=10> <B><FONT COLOR="#0033CC" SIZE="2" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
              Obs: Each alarm line shows the prefix that triggered the alarm, the number<br>
              of times it happened and the time when it first happened.<br>  
         </FONT></B>  </TD>
      </TR>
      <TR  ALIGN=CENTER>
         <TD>
           <TABLE BORDER=0 CELLSPACING=0 CELLPADING=0>
            <TR>
             <TD  ALIGN=CENTER WIDTH="50%">
              <FORM method="GET" action="http://www.ris.ripe.net/cgi-bin/myas/accounts/xxx/alarmstatus.cgi";>
                <TABLE border=0 WIDTH=400>
                   <TR> <TD>  
                       <FONT COLOR="#0033CC"  SIZE="2"  ALIGN=LEFT FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif"> <b>
                        Alarm events:  </b>
                  </TD> </TR>
EOF2

my $count = 0;
foreach my $alarm (@alarms){
    my @alarmline = split(/ - /, $alarm);
    if($alarmline[0]=~/origin/){
	print "<TR> <TD><input type=radio name=originalarms value='$count' <FONT COLOR=$alarmline[4] SIZE='2'> $alarmline[1]  - $alarmline[2]  -  $alarmline[3]</FONT> </TD> </TR> \n";
    }
    $count++;
}   

print <<EOF2;
                   <TR> <TD>  <input type=submit name=action VALUE="CLOSEUP_ORIGIN">  </TD> </TR>
                 </TABLE>
              </FORM>
             </TD>
             <TD  WIDTH="15%"> </TD>
             <TD  WIDTH="35%">
                <P><FONT COLOR="#0033CC"  SIZE="2"  ALIGN=LEFT FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
                   <b>Alarm detail:</b>
                </FONT></P> 
                <textarea name=originmessage cols=40 rows=10>
EOF2

    my @message = split(/spc/,$obgpmessage);
    foreach my $aux (@message){
	$aux=~s/spc/\n/s;
	print $aux . "\n";
    }


 print <<EOF3;            
               </textarea>
             </TD>
            </TR>  
            <TR>
         </table>
       </TD> 
      </TR>


      <TR>
         <TD HEIGHT=10 > <hr> </TD>
      </TR>
     <TR  ALIGN=CENTER> 
         <TD HEIGHT=10> <B><FONT COLOR="#0033CC" SIZE="4" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
         Transit provider alarm 

         </FONT></B>  </TD>
      </TR>
      <TR  ALIGN=CENTER> 
         <TD HEIGHT=10> <B><FONT COLOR="#0033CC" SIZE="2" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
              Obs: Each alarm line shows the prefix,the AS number that triggered the alarm, the number<br>
              of times it happened and the time when it first happened. For non active alarms the last <br>
              field shows the time it was canceled<br>  
         </FONT></B>  </TD>
      </TR>
      <TR  ALIGN=CENTER>
         <TD>
           <TABLE BORDER=0 CELLSPACING=0 CELLPADING=0>
            <TR>
             <TD  ALIGN=CENTER WIDTH="50%">
              <FORM method="GET" action="http://www.ris.ripe.net/cgi-bin/myas/accounts/xxx/alarmstatus.cgi";>
                <TABLE border=0 WIDTH=400>
                   <TR> <TD>  
                       <FONT COLOR="#0033CC"  SIZE="2"  ALIGN=LEFT FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif"> <b>
                        Alarm events:  </b>
                  </TD> </TR>
EOF3

 $count = 0;
foreach my $alarm (@alarms){
    my @alarmline = split(/ - /, $alarm);
    if($alarmline[0]=~/provider/){
	print "<TR> <TD><input type=radio name=originalarms value='$count' <FONT COLOR=$alarmline[4] SIZE='2' >$alarmline[6]  -  $alarmline[1]  - $alarmline[2]  -  $alarmline[3]</FONT> </TD> </TR> \n";
    }
    $count++;
}   

print <<EOF2;
                   <TR> <TD>  <input type=submit name=action VALUE="CLOSEUP_TRANSIT">  </TD> </TR>
                 </TABLE>
              </FORM>
             </TD>
             <TD  WIDTH="15%"> </TD>
             <TD  WIDTH="35%">
                <P><FONT COLOR="#0033CC"  SIZE="2"  ALIGN=LEFT FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
                   <b>Alarm detail:</b>
                </FONT></P> 
                <textarea name=originmessage cols=40 rows=10> 
EOF2
    @message = ();
    @message = split(/spc/,$tbgpmessage);
    foreach my $aux (@message){
	$aux=~s/spc/\n/s;
	print $aux . "\n";
    }

print <<EOF4;
              
             
               </textarea>
             </TD>
            </TR>  
           </TABLE>
         </TD> 
      </TR>


      <TR>
         <TD HEIGHT=10 > <hr> </TD>
      </TR>
     <TR  ALIGN=CENTER> 
         <TD HEIGHT=10> <B><FONT COLOR="#0033CC" SIZE="4" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
         Customer alarm 
         </FONT></B>  </TD>
      </TR>
      <TR  ALIGN=CENTER> 
         <TD HEIGHT=10> <B><FONT COLOR="#0033CC" SIZE="2" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
              Obs: Each alarm line shows the AS number that triggered the alarm, the number<br>
              of times it happened and the time when it first happened.<br>  
         </FONT></B>  </TD>
      </TR>
      <TR  ALIGN=CENTER>
         <TD>
           <TABLE BORDER=0 CELLSPACING=0 CELLPADING=0>
            <TR>
             <TD  ALIGN=CENTER WIDTH="50%">
              <FORM method="GET" action="http://www.ris.ripe.net/cgi-bin/myas/accounts/xxx/alarmstatus.cgi";>
                <TABLE border=0 WIDTH=400>
                   <TR> <TD>  
                       <FONT COLOR="#0033CC"  SIZE="2"  ALIGN=LEFT FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif"> <b>
                        Alarm events:  </b>
                  </TD> </TR>
EOF4
 $count = 0;
foreach my $alarm (@alarms){
    my @alarmline = split(/ - /, $alarm);
    if($alarmline[0]=~/customer/){
	print "<TR> <TD><input type=radio name=originalarms value='$count' <FONT COLOR=$alarmline[4] SIZE='2'> $alarmline[6]   - $alarmline[1]  - $alarmline[2]  -  $alarmline[3]</FONT> </TD> </TR> \n";
    }
    $count++;
}   

print <<EOF2;
                   <TR> <TD>  <input type=submit name=action VALUE="CLOSEUP_CUSTOMER">  </TD> </TR>
                 </TABLE>
              </FORM>
             </TD>
             <TD  WIDTH="15%"> </TD>
             <TD  WIDTH="35%">
                <P><FONT COLOR="#0033CC"  SIZE="2"  ALIGN=LEFT FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif">
                   <b>Alarm detail:</b>
                </FONT></P> 
                <textarea name=originmessage cols=40 rows=10> 

EOF2
    @message = ();
    @message = split(/spc/,$cbgpmessage);
    foreach my $aux (@message){
	$aux=~s/spc/\n/s;
	print $aux . "\n";
    }   

print <<EOF5;
             
               </textarea>
             </TD>
            </TR>  
           </TABLE>
         </TD> 
      </TR>



</TABLE> 
</BODY> 
</HTML> 

EOF5





sub get_permit {

    foreach my $line (@users){
	if($line=~/$loggeduser/){
	    my $aux = (split(/\s/, $line))[3];
	    return 1 if($aux=~/yes/);
	    return 0 if($aux=~/no/);
	}
    }

}


sub login_manager{

    if($fields{'LOGIN'}){ #the user has logged in before 
	$loggeduser = $fields{'LOGIN'};
        $writepermit = &get_permit($loggeduser);
    }else{
	my $aux = `printenv`;
        my @aux = split(/\s/, $aux);
	foreach my $auxstr (@aux){
	    if($auxstr=~/REMOTE_USER/){
		$loggeduser = (split(/=/,$auxstr))[1];
		last;
	    }
	}
	$writepermit = &get_permit($loggeduser);
    }

    if($DEBUG){

	print "USER: $loggeduser\n";
	print "PERMIT:  $writepermit\n";

    }

}# login_manager ends here !!!




sub read_alarming_file{

    unless(open(FP, $ALARMINGFILE)){
	print "Could not open file! \n";
	die;
    }
    while(<FP>){
	s/\n//;
	push @alarms, $_;
    }
    close(FP);

}


sub read_config_file {
 $debug = $debug . "read_config_file<br>";
unless(open(FP,$CONFIGFILE)){
    print "Could not open file! \n";
    die;
}


while(<FP>){
 
    next if(($_ =~ /^\#/) &&  ($_ =~ /^\s+$/));
    s/\n//;
    if(/@ ORIGIN/){
	s/@ ORIGIN//;
        s/\s//;
        push @origin, $_;
    }
    if(/@ PROVIDERS/){
	s/@ PROVIDERS//;
	s/\s//;
	push @provider, $_;
    }
    if(/@ CUSTOMERS/){
	s/@ CUSTOMERS//;
	s/\s//;
	push @customer, $_;
    }
    if(/@ USER/){
	s/@ USER//;
	s/\s//;
        push @users, $_;
    }
    if(/@ AS/){
	s/@ AS//;
        $as = $_;
    }
}

close(FP);

}#  read_config_file ends here !!! 











<<< Chronological >>> Author    Subject <<< Threads >>>