# HG changeset patch
# User devi
# Date 1132328769 -7200
# Node ID 219389279acbdcf16002cfb91555c4e4b9dfac3f
# Parent cb822611b24005fcd3d515c3eedd10f631ab9bf5
Множество изменений, которые были сделаны в ходе
первой обкатки LiLaLo в реальных условиях.
Добавлена фильтрация и возможность просмотра
смешанного журнала с хоста, без разделения по пользователям
diff -r cb822611b240 -r 219389279acb l3-agent
--- a/l3-agent Mon Nov 14 21:24:14 2005 +0200
+++ b/l3-agent Fri Nov 18 17:46:09 2005 +0200
@@ -809,6 +809,7 @@
print OUT "",$cl->{raw_file},"\n";
print OUT "",$cl->{tty},"\n";
print OUT "",$out_class,"\n";
+ print OUT "",$out_class,"\n";
print OUT "";
printq(\*OUT,,$cl->{"prompt"});
print OUT "";
diff -r cb822611b240 -r 219389279acb l3-cgi
--- a/l3-cgi Mon Nov 14 21:24:14 2005 +0200
+++ b/l3-cgi Fri Nov 18 17:46:09 2005 +0200
@@ -9,13 +9,10 @@
require l3config;
};
-my @filter;
+my %filter;
-for my $i (qw(host)) {
- my $value = param("$i");
- if ($value) {
- push @filter, "$i=$value";
- }
+for my $key (qw(login_from)) {
+ $filter{$key} = param($key) if param($key);
}
my %Trainings;
@@ -117,7 +114,10 @@
if ($course ne 'current') {
push @args, ("--backend_datafile" => "/var/lilalo/lablogs-xml/$course/$host/$user.xml");
} else {
- push @args, ("--filter" => "hostname=".$host."&user=".$user);
+ $filter{hostname} = $host if $host;
+ $filter{user} = $user if $user;
+ push @args, ("--filter" => join ("&", (map("$_=$filter{$_}", keys %filter))));
+ #push @args, ("--filter" => "hostname=".$host."&user=".$user);
}
open (FRONTEND, "./l3-frontend ".join(" ",map("\"$_\"",@args))." |");
diff -r cb822611b240 -r 219389279acb l3-frontend
--- a/l3-frontend Mon Nov 14 21:24:14 2005 +0200
+++ b/l3-frontend Fri Nov 18 17:46:09 2005 +0200
@@ -355,7 +355,7 @@
$j++;
$j++ while ($j <= @Command_Lines && $Command_Lines[$j]->{tty} ne $$cl->{tty} || !$Command_Lines[$j]);
}
- $Command_Lines[$j]->{note}="$2";
+ $Command_Lines[$j]->{note}.="$2\n";
$$cl=0;
}
}
@@ -414,13 +414,13 @@
$filter{$var} = $val;
}
- if ($filter{hostname}) {
- next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{hostname} eq $filter{hostname};
+ for my $filter_key (keys %filter) {
+ next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{$filter_key} eq $filter{$filter_key};
}
- if ($filter{user}) {
- next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{user} eq $filter{user};
- }
+ #if ($filter{user}) {
+ # next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{user} eq $filter{user};
+ #}
#for my $filter_field (keys %filter) {
# next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{$filter_field} eq $filter{$filter_field};
@@ -635,8 +635,7 @@
ErrorsPercentage => "Процент команд с ненулевым кодом завершения, %",
TotalTime => "Суммарное время работы с терминалом *, час",
CommandsPerTime => "Количество командных строк в единицу времени, команда/мин",
- CommandsFDistribution => "Частота использования команд",
- CommandsFDistribution => "Частота использования команд",
+ CommandsFrequency => "Частота использования команд",
RareCommands => "Частота использования этих команд < 0.5%",
);
@StatOrder = (
@@ -646,7 +645,7 @@
ErrorsPercentage,
TotalTime,
CommandsPerTime,
- CommandsFDistribution,
+ CommandsFrequency,
RareCommands,
);
@@ -654,6 +653,8 @@
# Некоторые значения пересчитываются!
# Дальше их лучше уже не использовать!!!
+ my %CommandsFrequency = %CommandsFDistribution;
+
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{FirstCommand});
$Stat{FirstCommand} = sprintf "%02i:%02i:%02i %04i-%2i-%2i", $hour, $min, $sec, $year+1900, $mon+1, $mday;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{LastCommand});
@@ -665,19 +666,19 @@
$Stat{TotalTime} = sprintf "%5.2f", $Stat{TotalTime}/60/60;
my $total_commands=0;
- for $command (keys %CommandsFDistribution){
- $total_commands += $CommandsFDistribution{$command};
+ for $command (keys %CommandsFrequency){
+ $total_commands += $CommandsFrequency{$command};
}
if ($total_commands) {
- for $command (reverse sort {$CommandsFDistribution{$a} <=> $CommandsFDistribution{$b}} keys %CommandsFDistribution){
+ for $command (reverse sort {$CommandsFrequency{$a} <=> $CommandsFrequency{$b}} keys %CommandsFrequency){
my $command_html;
- my $percentage = sprintf "%5.2f",$CommandsFDistribution{$command}*100/$total_commands;
+ my $percentage = sprintf "%5.2f",$CommandsFrequency{$command}*100/$total_commands;
if ($percentage < 0.5) {
my $hint = make_comment($command);
$command_html = "$command";
$command_html = "$command_html" if $hint;
my $command_html = "$command_html";
- $Stat{RareCommands} .= $command_html."".$CommandsFDistribution{$command}." , ";
+ $Stat{RareCommands} .= $command_html."".$CommandsFrequency{$command}." , ";
}
else {
my $hint = make_comment($command);
@@ -685,11 +686,11 @@
$command_html = "$command_html" if $hint;
my $command_html = "$command_html";
$percentage = sprintf "%5.2f",$percentage;
- $Stat{CommandsFDistribution} .= "
".$command_html." | ".$CommandsFDistribution{$command}." | ".
- "|".("="x int($CommandsFDistribution{$command}*100/$total_commands))."| $percentage% |
";
+ $Stat{CommandsFrequency} .= "".$command_html." | ".$CommandsFrequency{$command}." | ".
+ "|".("="x int($CommandsFrequency{$command}*100/$total_commands))."| $percentage% |
";
}
}
- $Stat{CommandsFDistribution} = "".$Stat{CommandsFDistribution}."
";
+ $Stat{CommandsFrequency} = "".$Stat{CommandsFrequency}."
";
$Stat{RareCommands} =~ s/, $// if $Stat{RareCommands};
}
diff -r cb822611b240 -r 219389279acb lm
--- a/lm Mon Nov 14 21:24:14 2005 +0200
+++ b/lm Fri Nov 18 17:46:09 2005 +0200
@@ -504,7 +504,7 @@
for i in $dirs
do
mkdir -p $lablogs/${i##*/}
- scp -q $ssh_user@$host:${i}/.labmaker/* $lablogs/${i##*/}
+ scp -q $ssh_user@$host:${i}/.lilalo/* $lablogs/${i##*/}
done
###setlab