[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mldonkey-users] output of client_stats
From: |
Michael Panteleit |
Subject: |
Re: [Mldonkey-users] output of client_stats |
Date: |
26 Dec 2002 21:29:56 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
winhasser <address@hidden> writes:
> Indeed very nice work. Could you please post the script?
You have to do a very tiny patch to driver/driverControlers.ml at line 140:
original:
eval auth cmd options;
Buffer.add_char buf '\n';
TcpBufferedSocket.write_string sock (Buffer.contents buf);
modified:
eval auth cmd options;
Buffer.add_char buf '\n';
Buffer.add_char buf '>';
TcpBufferedSocket.write_string sock (Buffer.contents buf);
As far as I can see it won't break anything. But it delivers the
prompt I need for the following Perl-Script:
#!/usr/bin/perl -w
use strict;
use Net::Telnet;
my $tel;
my %stats;
my @lines;
my $kind;
my ($uptime,$uptime1);
my %clients = ( 'Total' => 0,
'eDonkey' => 1,
'old mldonkey' => 2,
'new mldonkey' => 3,
'Overnet' => 4,
'old eMule' => 5,
'new eMule' => 6,
'server' => 7
);
$tel = new Net::Telnet(Host=>"derry", Port=>4000, Prompt=>'/^\s*$/');
$tel->waitfor('/Welcome on mldonkey command-line/');
@lines = $tel->cmd(String=>'client_stats', Prompt=>'/>\s>$/');
for my $line ( $tel->cmd(String=>'client_stats', Prompt=>'/>\s>$/') ){
if ($line =~ /(\d+) sec.*\((.*)\)/){
$uptime = $1;
$uptime1= $2;
next;
};
if ($line =~ /Total (\w*)\D+(\d+)/){
$kind = $1;
$stats{$kind}->[0] = $2;
next;
};
$line =~ /\s+(.*):\D+(\d+)/;
$stats{$kind}->[$clients{$1}] = $2;
}
print "Uptime: $uptime $uptime1\n";
printf " Client seen | Downloads | Uploads | Banned\n";
printf "%12s %5d %5.1f%%| %5.1f %5.1f| %5.1f %5.1f| %3d %3.1f%%\n",
$_,
$stats{seens}->[$clients{$_}],
$stats{seens}->[$clients{$_}]/$stats{seens}->[$clients{Total}]*100,
$stats{downloads}->[$clients{$_}]/1024/1024,
$stats{downloads}->[$clients{$_}]/$uptime/1024,
$stats{uploads}->[$clients{$_}]/1024/1024,
$stats{uploads}->[$clients{$_}]/$uptime/1024,
$stats{banneds}->[$clients{$_}],
$stats{banneds}->[$clients{$_}]/($stats{seens}->[$clients{$_}]+1)*100
foreach ( sort {$clients{$a}<=>$clients{$b}} keys %clients );
One problem: I forgot that as long as there is no upload/download/ban
there is the message "You didn't upload anything". You have to wait
'til there is no such message in client_stats.
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, (continued)
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Pierre Etchemaite, 2002/12/24
- [Mldonkey-users] Need a prompt in telnet interface, Michael Panteleit, 2002/12/25
- Re: [Mldonkey-users] Need a prompt in telnet interface, Taros666, 2002/12/25
- Re: [Mldonkey-users] Need a prompt in telnet interface, Michael Panteleit, 2002/12/25
- [Mldonkey-users] Traffic shaping, Sergio Bayarri Gausi, 2002/12/25
- AW: [Mldonkey-users] Traffic shaping, Roland Praml, 2002/12/25
- Re: [Mldonkey-users] Need a prompt in telnet interface, Carl Lobo, 2002/12/25
- Re: [Mldonkey-users] Need a prompt in telnet interface, Michael Panteleit, 2002/12/26
- [Mldonkey-users] output of client_stats, Michael Panteleit, 2002/12/26
- Re: [Mldonkey-users] output of client_stats, winhasser, 2002/12/26
- Re: [Mldonkey-users] output of client_stats,
Michael Panteleit <=
- Re: [Mldonkey-users] output of client_stats, Andre Hinrichs, 2002/12/26
- Re: [Mldonkey-users] output of client_stats, Michael Panteleit, 2002/12/26
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Fabian Henrici, 2002/12/25
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Christian Kaltepoth, 2002/12/25
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, robber, 2002/12/26
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Fabian Henrici, 2002/12/23
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Fabian Henrici, 2002/12/23
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Fabian Henrici, 2002/12/23
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Martin, 2002/12/24
- Re: [Mldonkey-users] Investigation: No download for some, full downloads for the other, Michael Panteleit, 2002/12/24