line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Opentracker::Stats::Mode::HttpErrors; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31238
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
|
|
5
|
use parent qw/ |
7
|
|
|
|
|
|
|
WWW::Opentracker::Stats::Mode |
8
|
|
|
|
|
|
|
Class::Accessor::Fast |
9
|
1
|
|
|
1
|
|
795
|
/; |
|
1
|
|
|
|
|
308
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->_format('txt'); |
13
|
|
|
|
|
|
|
__PACKAGE__->_mode('herr'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/_stats/); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
WWW::Opentracker::Stats::Mode::HttpErrors |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Parses the HTTP errors statistics from opentracker. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 parse_stats |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Args: $self, $payload |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Decodes the plain text data retrieved from the HTTP errors statistics of |
33
|
|
|
|
|
|
|
opentracker. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The payload looks like this (no indentation): |
36
|
|
|
|
|
|
|
302 RED 1 |
37
|
|
|
|
|
|
|
400 ... 2 |
38
|
|
|
|
|
|
|
400 PAR 3 |
39
|
|
|
|
|
|
|
400 COM 4 |
40
|
|
|
|
|
|
|
403 IP 5 |
41
|
|
|
|
|
|
|
404 INV 6 |
42
|
|
|
|
|
|
|
500 SRV 46 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub parse_stats { |
47
|
1
|
|
|
1
|
1
|
3
|
my ($self, $payload) = @_; |
48
|
|
|
|
|
|
|
|
49
|
1
|
50
|
|
|
|
15
|
my ($e302red, $e400, $e400par, $e400com, $e403ip, $e404inv, $e500srv) |
50
|
|
|
|
|
|
|
= $payload =~ m{\A |
51
|
|
|
|
|
|
|
302 \s RED \s+ (\d+) \s |
52
|
|
|
|
|
|
|
400 \s \.{3} \s+ (\d+) \s |
53
|
|
|
|
|
|
|
400 \s PAR \s+ (\d+) \s |
54
|
|
|
|
|
|
|
400 \s COM \s+ (\d+) \s |
55
|
|
|
|
|
|
|
403 \s IP \s+ (\d+) \s |
56
|
|
|
|
|
|
|
404 \s INV \s+ (\d+) \s |
57
|
|
|
|
|
|
|
500 \s SRV \s+ (\d+) |
58
|
|
|
|
|
|
|
}xms |
59
|
|
|
|
|
|
|
or die "Unable to parse payload: $payload"; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
10
|
my %stats = ( |
62
|
|
|
|
|
|
|
'302red' => $e302red, |
63
|
|
|
|
|
|
|
'400' => $e400, |
64
|
|
|
|
|
|
|
'400par' => $e400par, |
65
|
|
|
|
|
|
|
'400com' => $e400com, |
66
|
|
|
|
|
|
|
'403ip' => $e403ip, |
67
|
|
|
|
|
|
|
'404inv' => $e404inv, |
68
|
|
|
|
|
|
|
'500srv' => $e500srv, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
10
|
return \%stats; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SEE ALSO |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Knut-Olav Hoven, Eknutolav@gmail.comE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Copyright (C) 2009 by Knut-Olav Hoven |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
88
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
89
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|