mrtg/webstat.pl

Fri, 15 Oct 2010 19:06:09 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 15 Oct 2010 19:06:09 +0200
changeset 263
f4a0b439d0fb
parent 135
cd68ee26852b
child 737
b3e405e9af87
permissions
-rw-r--r--

Correct shared library and plugin link logic, as well as informal text.
Update file server URL, update build resource estimations, correct RPATH
logic, allow for qmake(1) static to shared library changes via CONFIG
argument, correct documentation broken title and index links, correct
shared library install path, install only one set of (correct) plugins,
install the designer shared library (as required by QtCreator), announce
features related to shared linking using qmake(1), and correclty
substitute hard coded paths in prl and la library files.

     1 #! @l_prefix@/bin/perl
     2 ##
     3 ##  webstats.pl: return HTTP server hits and bytes
     4 ##
     5 ##  Configure Apache HTTP server like so:
     6 ##    <Location /server-status>
     7 ##        SetHandler server-status
     8 ##        Order allow,deny
     9 ##        Allow from localhost
    10 ##    </Location>
    11 ##    ExtendedStatus On
    12 ##
    14 @res = `@l_prefix@/bin/lynx -dump http://localhost/server-status`;
    16 foreach $res (@res) {
    17     if ($res =~ /Server uptime: (.*)$/) {
    18         $up = $1;last
    19     }
    20     else {
    21         next
    22     }
    24     if ($res =~ /Server at/) {
    25         $server = $res;
    26         last
    27     }
    28     else {
    29         next
    30     }
    31 }
    33 @res = `@l_prefix@/bin/lynx -dump http://localhost/server-status?auto`;
    35 foreach $res (@res) {
    36     if ($res =~ /Total Accesses: (\d+)/) {
    37         $d1 = $1;
    38         next
    39     }
    41     if ($res =~ /Total kBytes: (\d+)/) {
    42         $d2 = $1 * 1024;
    43         next
    44     }
    45 }
    47 $d1 = int($d1);
    48 $d2 = int($d2);
    50 if ($ARGV[0] eq "hits") {
    51     print "$d1\n";
    52     print "$d1\n";
    53 } elsif ($ARGV[0] eq "bytes") {
    54     print "$d2\n";
    55     print "$d2\n";
    56 }
    58 print "$up\n";
    59 print "$server";
    60 print "$null\n";
    61 print "$null\n";

mercurial