mrtg/webstat.pl

changeset 176
7ed48a3146ba
parent 135
cd68ee26852b
child 737
b3e405e9af87
equal deleted inserted replaced
0:c7fa024a74cd 1:47fb62dc64c7
1 #!@l_prefix@/bin/perl 1 #! @l_prefix@/bin/perl
2 ## 2 ##
3 ## webstats.pl: return HTTP server hits and bytes 3 ## webstats.pl: return HTTP server hits and bytes
4 ## 4 ##
5 ## Configure Apache HTTP server like so: 5 ## Configure Apache HTTP server like so:
6 ## <Location /server-status> 6 ## <Location /server-status>
15 15
16 foreach $res (@res) { 16 foreach $res (@res) {
17 if ($res =~ /Server uptime: (.*)$/) { 17 if ($res =~ /Server uptime: (.*)$/) {
18 $up = $1;last 18 $up = $1;last
19 } 19 }
20 else 20 else {
21 next 21 next
22 }
22 23
23 if ($res =~ /Server at/) { 24 if ($res =~ /Server at/) {
24 $server = $res; 25 $server = $res;
25 last 26 last
26 } 27 }
27 else 28 else {
28 next 29 next
30 }
29 } 31 }
30 32
31 @res = `@l_prefix@/bin/lynx -dump http://localhost/server-status?auto`; 33 @res = `@l_prefix@/bin/lynx -dump http://localhost/server-status?auto`;
32 34
33 foreach $res (@res) { 35 foreach $res (@res) {
53 print "$d2\n"; 55 print "$d2\n";
54 } 56 }
55 57
56 print "$up\n"; 58 print "$up\n";
57 print "$server"; 59 print "$server";
60 print "$null\n";
61 print "$null\n";
58 62

mercurial