lilalo
changeset 37:219389279acb
Множество изменений, которые были сделаны в ходе
первой обкатки LiLaLo в реальных условиях.
Добавлена фильтрация и возможность просмотра
смешанного журнала с хоста, без разделения по пользователям
первой обкатки LiLaLo в реальных условиях.
Добавлена фильтрация и возможность просмотра
смешанного журнала с хоста, без разделения по пользователям
author | devi |
---|---|
date | Fri Nov 18 17:46:09 2005 +0200 (2005-11-18) |
parents | cb822611b240 |
children | 466bea239d25 |
files | l3-agent l3-cgi l3-frontend lm |
line diff
1.1 --- a/l3-agent Mon Nov 14 21:24:14 2005 +0200 1.2 +++ b/l3-agent Fri Nov 18 17:46:09 2005 +0200 1.3 @@ -809,6 +809,7 @@ 1.4 print OUT "<raw_file>",$cl->{raw_file},"</raw_file>\n"; 1.5 print OUT "<tty>",$cl->{tty},"</tty>\n"; 1.6 print OUT "<out_class>",$out_class,"</out_class>\n"; 1.7 + print OUT "<err>",$out_class,"</err>\n"; 1.8 print OUT "<prompt>"; 1.9 printq(\*OUT,,$cl->{"prompt"}); 1.10 print OUT "</prompt>";
2.1 --- a/l3-cgi Mon Nov 14 21:24:14 2005 +0200 2.2 +++ b/l3-cgi Fri Nov 18 17:46:09 2005 +0200 2.3 @@ -9,13 +9,10 @@ 2.4 require l3config; 2.5 }; 2.6 2.7 -my @filter; 2.8 +my %filter; 2.9 2.10 -for my $i (qw(host)) { 2.11 - my $value = param("$i"); 2.12 - if ($value) { 2.13 - push @filter, "$i=$value"; 2.14 - } 2.15 +for my $key (qw(login_from)) { 2.16 + $filter{$key} = param($key) if param($key); 2.17 } 2.18 2.19 my %Trainings; 2.20 @@ -117,7 +114,10 @@ 2.21 if ($course ne 'current') { 2.22 push @args, ("--backend_datafile" => "/var/lilalo/lablogs-xml/$course/$host/$user.xml"); 2.23 } else { 2.24 - push @args, ("--filter" => "hostname=".$host."&user=".$user); 2.25 + $filter{hostname} = $host if $host; 2.26 + $filter{user} = $user if $user; 2.27 + push @args, ("--filter" => join ("&", (map("$_=$filter{$_}", keys %filter)))); 2.28 + #push @args, ("--filter" => "hostname=".$host."&user=".$user); 2.29 } 2.30 2.31 open (FRONTEND, "./l3-frontend ".join(" ",map("\"$_\"",@args))." |");
3.1 --- a/l3-frontend Mon Nov 14 21:24:14 2005 +0200 3.2 +++ b/l3-frontend Fri Nov 18 17:46:09 2005 +0200 3.3 @@ -355,7 +355,7 @@ 3.4 $j++; 3.5 $j++ while ($j <= @Command_Lines && $Command_Lines[$j]->{tty} ne $$cl->{tty} || !$Command_Lines[$j]); 3.6 } 3.7 - $Command_Lines[$j]->{note}="$2"; 3.8 + $Command_Lines[$j]->{note}.="$2\n"; 3.9 $$cl=0; 3.10 } 3.11 } 3.12 @@ -414,13 +414,13 @@ 3.13 $filter{$var} = $val; 3.14 } 3.15 3.16 - if ($filter{hostname}) { 3.17 - next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{hostname} eq $filter{hostname}; 3.18 + for my $filter_key (keys %filter) { 3.19 + next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{$filter_key} eq $filter{$filter_key}; 3.20 } 3.21 3.22 - if ($filter{user}) { 3.23 - next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{user} eq $filter{user}; 3.24 - } 3.25 + #if ($filter{user}) { 3.26 + # next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{user} eq $filter{user}; 3.27 + #} 3.28 3.29 #for my $filter_field (keys %filter) { 3.30 # next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{$filter_field} eq $filter{$filter_field}; 3.31 @@ -635,8 +635,7 @@ 3.32 ErrorsPercentage => "Процент команд с ненулевым кодом завершения, %", 3.33 TotalTime => "Суммарное время работы с терминалом <sup><font size='-2'>*</font></sup>, час", 3.34 CommandsPerTime => "Количество командных строк в единицу времени, команда/мин", 3.35 - CommandsFDistribution => "Частота использования команд", 3.36 - CommandsFDistribution => "Частота использования команд", 3.37 + CommandsFrequency => "Частота использования команд", 3.38 RareCommands => "Частота использования этих команд < 0.5%", 3.39 ); 3.40 @StatOrder = ( 3.41 @@ -646,7 +645,7 @@ 3.42 ErrorsPercentage, 3.43 TotalTime, 3.44 CommandsPerTime, 3.45 - CommandsFDistribution, 3.46 + CommandsFrequency, 3.47 RareCommands, 3.48 ); 3.49 3.50 @@ -654,6 +653,8 @@ 3.51 # Некоторые значения пересчитываются! 3.52 # Дальше их лучше уже не использовать!!! 3.53 3.54 + my %CommandsFrequency = %CommandsFDistribution; 3.55 + 3.56 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{FirstCommand}); 3.57 $Stat{FirstCommand} = sprintf "%02i:%02i:%02i %04i-%2i-%2i", $hour, $min, $sec, $year+1900, $mon+1, $mday; 3.58 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{LastCommand}); 3.59 @@ -665,19 +666,19 @@ 3.60 $Stat{TotalTime} = sprintf "%5.2f", $Stat{TotalTime}/60/60; 3.61 3.62 my $total_commands=0; 3.63 - for $command (keys %CommandsFDistribution){ 3.64 - $total_commands += $CommandsFDistribution{$command}; 3.65 + for $command (keys %CommandsFrequency){ 3.66 + $total_commands += $CommandsFrequency{$command}; 3.67 } 3.68 if ($total_commands) { 3.69 - for $command (reverse sort {$CommandsFDistribution{$a} <=> $CommandsFDistribution{$b}} keys %CommandsFDistribution){ 3.70 + for $command (reverse sort {$CommandsFrequency{$a} <=> $CommandsFrequency{$b}} keys %CommandsFrequency){ 3.71 my $command_html; 3.72 - my $percentage = sprintf "%5.2f",$CommandsFDistribution{$command}*100/$total_commands; 3.73 + my $percentage = sprintf "%5.2f",$CommandsFrequency{$command}*100/$total_commands; 3.74 if ($percentage < 0.5) { 3.75 my $hint = make_comment($command); 3.76 $command_html = "$command"; 3.77 $command_html = "<span title='$hint' class='hint'>$command_html</span>" if $hint; 3.78 my $command_html = "<tt>$command_html</tt>"; 3.79 - $Stat{RareCommands} .= $command_html."<sub><font size='-2'>".$CommandsFDistribution{$command}."</font></sub> , "; 3.80 + $Stat{RareCommands} .= $command_html."<sub><font size='-2'>".$CommandsFrequency{$command}."</font></sub> , "; 3.81 } 3.82 else { 3.83 my $hint = make_comment($command); 3.84 @@ -685,11 +686,11 @@ 3.85 $command_html = "<span title='$hint' class='hint'>$command_html</span>" if $hint; 3.86 my $command_html = "<tt>$command_html</tt>"; 3.87 $percentage = sprintf "%5.2f",$percentage; 3.88 - $Stat{CommandsFDistribution} .= "<tr><td>".$command_html."</td><td>".$CommandsFDistribution{$command}."</td>". 3.89 - "<td>|".("="x int($CommandsFDistribution{$command}*100/$total_commands))."| $percentage%</td></tr>"; 3.90 + $Stat{CommandsFrequency} .= "<tr><td>".$command_html."</td><td>".$CommandsFrequency{$command}."</td>". 3.91 + "<td>|".("="x int($CommandsFrequency{$command}*100/$total_commands))."| $percentage%</td></tr>"; 3.92 } 3.93 } 3.94 - $Stat{CommandsFDistribution} = "<table>".$Stat{CommandsFDistribution}."</table>"; 3.95 + $Stat{CommandsFrequency} = "<table>".$Stat{CommandsFrequency}."</table>"; 3.96 $Stat{RareCommands} =~ s/, $// if $Stat{RareCommands}; 3.97 } 3.98
4.1 --- a/lm Mon Nov 14 21:24:14 2005 +0200 4.2 +++ b/lm Fri Nov 18 17:46:09 2005 +0200 4.3 @@ -504,7 +504,7 @@ 4.4 for i in $dirs 4.5 do 4.6 mkdir -p $lablogs/${i##*/} 4.7 - scp -q $ssh_user@$host:${i}/.labmaker/* $lablogs/${i##*/} 4.8 + scp -q $ssh_user@$host:${i}/.lilalo/* $lablogs/${i##*/} 4.9 done 4.10 4.11 ###setlab