From: doni on
Hi,

I wanted to extract specific information of MAC and PHY statistics from
the statistics log file. The Statistics file contains information other
than MAC and PHY also.
I am mainly concerned about "frames with invalid header" and "packets
with invalid length" from the MAC Statistics and "transmit errors" from
PHY Statistics.
Can anyone let me know how can I extract this information.

Here is a snapshot of the Statistics file that gets generated.

MAC statistics:
0 frames with invalid header
546 confirmed frames sent succesfully
1693 confirmed frames sent unsuccesfully
542 confirmed frames received
4597 total frames received
851 data packets received
549 packets sent successfully
152 packets sent unsuccessfully
763 packets queued by network layer
61 packet transmissions timed out
0 packets with invalid length
0 out of order fragments received
87 duplicate fragments received
0 partial packets received
4 packet reassemblies timed out
0 no buffers
PHY statistics:
3404 frames transmitted
105 transmits aborted due to rx
0 transmit errors
0 late transmits
11 tx buffer loads interrupted
0 tx buffer load failures
4598 receive interrupts
4598 frames received
0 received frames lost
0 zero length frames received
0 receive cmd errors
Network statistics:
851 total packets received
0 bad packet length
0 bad version number
0 outgoing packets with no route
0 input packets with bad destination address
0 input packets from wrong channel
0 packets dropped for exceeding TTL
0 packets dropped due to full socket buffers
0 packets dropped due to no receiver
0 packets dropped due to running out of memory
762 total packets sent
549 packets succesfully transmitted
213 packets sent unsuccessfully


Thanks,
doni

From: Michele Dondi on
On 23 Jan 2007 12:25:26 -0800, "doni" <doni.sekar(a)gmail.com> wrote:

>I am mainly concerned about "frames with invalid header" and "packets
>with invalid length" from the MAC Statistics and "transmit errors" from
>PHY Statistics.
>Can anyone let me know how can I extract this information.
>
>Here is a snapshot of the Statistics file that gets generated.
[snip]
>MAC statistics:
> 0 frames with invalid header

What have you tried thus far? In any case you may try some regexen
like

/(\d+)\s+frames with invalid header/


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
From: doni on

Michele Dondi wrote:

> What have you tried thus far? In any case you may try some regexen
> like
>
> /(\d+)\s+frames with invalid header/
>

I was trying to do something other than regexp so that If I need
multiple searches, I can easily incorporate them.
I didnt have much success till now...

#! /usr/bin/perl

use strict;
use warnings;

my $ex_data = 'netstat.log';
open (NETSTAT,$ex_data) || die("Cannot Open File: $!");

### Prompt the User for Input ###
print "Enter the stats(MAC or PHY) information that need to be
extracted:";
my $input = <STDIN>;
chomp($input);
print $input;

foreach $line(<NETSTAT>) {
chomp $line;
if ($input =~ m/^$line/i) {
print "We are going to extract RF MAC Statistics\n";
}
}
close(NETSTAT) || die("Cannot close $ex_data: $!");

From: DJ Stunks on
doni wrote:
> Michele Dondi wrote:
>
> > What have you tried thus far? In any case you may try some regexen
> > like
> >
> > /(\d+)\s+frames with invalid header/
> >
>
> I was trying to do something other than regexp so that If I need
> multiple searches, I can easily incorporate them.
> I didnt have much success till now...

#!/usr/bin/perl

use strict;
use warnings;

my (%statistics, $type);
while ( my $line = <DATA> ) {
if ( $line =~ m{^ (\S+) }x ) {
$type = $1;
}
elsif ( $line =~ m{ (\d+) \s+ (.+?) \s* $}mx ) {
$statistics{ $type }{ $2 } = $1;
}
}

print "MAC stats for 'frames with invalid header': ",
$statistics{ MAC }{ 'frames with invalid header' },
"\n";


__DATA__
MAC statistics:
0 frames with invalid header
546 confirmed frames sent succesfully
1693 confirmed frames sent unsuccesfully
542 confirmed frames received
4597 total frames received
851 data packets received
549 packets sent successfully
152 packets sent unsuccessfully
763 packets queued by network layer
61 packet transmissions timed out
0 packets with invalid length
0 out of order fragments received
87 duplicate fragments received
0 partial packets received
4 packet reassemblies timed out
0 no buffers
PHY statistics:
3404 frames transmitted
105 transmits aborted due to rx
0 transmit errors
0 late transmits
11 tx buffer loads interrupted
0 tx buffer load failures
4598 receive interrupts
4598 frames received
0 received frames lost
0 zero length frames received
0 receive cmd errors
Network statistics:
851 total packets received
0 bad packet length
0 bad version number
0 outgoing packets with no route
0 input packets with bad destination address
0 input packets from wrong channel
0 packets dropped for exceeding TTL
0 packets dropped due to full socket buffers
0 packets dropped due to no receiver
0 packets dropped due to running out of memory
762 total packets sent
549 packets succesfully transmitted
213 packets sent unsuccessfully

-jp

From: doni on


On Jan 23, 2:22 pm, "DJ Stunks" <DJStu...(a)gmail.com> wrote:
#!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my (%statistics, $type);
> while ( my $line = <DATA> ) {
> if ( $line =~ m{^ (\S+) }x ) {
> $type = $1;
> }
> elsif ( $line =~ m{ (\d+) \s+ (.+?) \s* $}mx ) {
> $statistics{ $type }{ $2 } = $1;
> }
> }
>
> print "MAC stats for 'frames with invalid header': ",
> $statistics{ MAC }{ 'frames with invalid header' },
> "\n";
>

I tried the above method but I didnt get any result for "frames with
invalid header"..

Sekar