]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - config/logwatch/dialup
"Update Booster" fertiggestellt und getestet.
[people/pmueller/ipfire-2.x.git] / config / logwatch / dialup
CommitLineData
81a7e7c8
MT
1
2##########################################################################
3# $Id: dialup $
4##########################################################################
5
6use Logwatch ':all';
7
8$Debug = ValueOrDefault($ENV{'LOGWATCH_DEBUG'}, 0);
9$Detail = ValueOrDefault($ENV{'LOGWATCH_DETAIL_LEVEL'}, 0);
10
11# Avoid "Use of uninitialized value" warning messages.
12sub ValueOrDefault {
13 my ($value, $default) = @_;
14 return ($value ? $value : $default);
15}
16
17if ( $Debug >= 5 ) {
18 print STDERR "\n\nDEBUG: Inside DIALUP Filter \n\n";
19 $DebugCounter = 1;
20}
21
22while (defined($ThisLine = <STDIN>)) {
23 if ( $Debug >= 5 ) {
24 print STDERR "DEBUG($DebugCounter): $ThisLine";
25 $DebugCounter++;
26 }
27 chomp($ThisLine);
28
29 if ( $ThisLine =~ /^pppd (\d+).(\d+).(\d+) started by root, uid (\d+)/ )
30 {
31 if ($Debug >= 5)
32 {
33 print STDERR "DEBUG: Found PPP start\n";
34 }
35 $Starts++
36 }
37 elsif ( $ThisLine =~ /^Connection terminated./ )
38 {
39 if ($Debug >= 5)
40 {
41 print STDERR "DEBUG: Found PPP down\n";
42 }
43 $Downs++
44 }
45 elsif ( $ThisLine =~ /^PPP session is (\d+)/ )
46 {
47 if ($Debug >= 5)
48 {
49 print STDERR "DEBUG: Found PPP connect\n";
50 }
51 $Ups++
52 }
53 elsif ( $ThisLine =~ /^Connect time (\d+).(\d+) minutes./ )
54 {
55 if ($Debug >= 5)
56 {
57 print STDERR "DEBUG: Found PPP connecttime $1\n";
58 }
59 $Uptime += $1 + ($2 / 10);
60 }
61}
62
63###########################################################
64
65if ( $Starts )
66{
67 print "PPP Dial attempts: " . $Starts . " Time(s)\n";
68}
69
70if ( $Ups )
71{
72 print "PPP Connected: " . $Ups . " Time(s)\n";
73}
74
75if ( $Downs )
76{
77 print "PPP Disconnected: " . $Downs . " Time(s)\n";
78}
79
80if ( $Uptime )
81{
82 print "Total connect time: " . $Uptime . " Minutes\n";
83}
84
85exit(0);
86
87# vi: shiftwidth=3 tabstop=3 syntax=perl et