mrtg/webstat.pl

Sat, 24 Mar 2012 21:40:49 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 24 Mar 2012 21:40:49 +0100
changeset 414
fd611cde817f
parent 135
cd68ee26852b
child 737
b3e405e9af87
permissions
-rw-r--r--

Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.

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

mercurial