[mrtg] Possible MaxInt problem in mrtg 2.9.10 ?

Soffen, Matthew msoffen at iso-ne.com
Wed Mar 21 16:07:38 MET 2001


I'm using a script that is working fine (manually verified) but it "seems"
like mrtg, when attempting to store this,   is hitting some sort of max
value limit.

I'm tracking bytes transferred from the web server and it is storing this in
the .log file

985186049 3796641792 3796641792
985186049 2131017728 2131017728 2131017728 2131017728
985186024 2131017728 2131017728 2131017728 2131017728
985185900 2131017728 2131017728 2131017728 2131017728

Its storing only the 2131017728 value.  I didn't see anything list
indicating any Max Int limits.  And this isn't a value that makes sense.  Is
there some limit of 2147483647 (7FFFFFFF) in the code - some integer that's
too small ?  If this is inherent (and not changeable) then I'll can just
convert to Kbytes instead of Bytes.

And if it is a "known" problem, maybe this can get added into the FAQ ?

Thanks.


The MRTG configuration and script are attached below:

# from mrtg configuration file.
Target[apache_bytes]: `/usr/local/etc/mrtg/webstat.pl bytes`
AbsMax[apache_bytes]:   10000000000
MaxBytes[apache_bytes]: 10000000000
WithPeak[apache_bytes]: wmy
Options[apache_bytes]: growright,gauge
ShortLegend[apache_bytes]: Apache Bytes
YLegend[apache_bytes]: Apache Bytes
LegendI[apache_bytes]: Bytes
LegendO[apache_bytes]: Apache
Title[apache_bytes]: www Apache Bytes
PageTop[apache_bytes]: <h1>www Apache Bytes <br></h1>
  <table>
    <tr><td>System:</td><td>www</td></tr>
    <tr><td>Maintainer:</td><td>msoffen at iso-ne.com</td><tr>
    <tr><td>IP:</td><td>www.iso-ne.com</td></tr>
  </table>

#!/usr/bin/perl
# webstat.pl
# depends on availability of status and extended status info from your
# Apache webserver -- your httpd.conf needs to include something like the
# following: (uncommented)
#<Location /server-status>
#    SetHandler server-status
#    Order allow,deny
#    Allow from localhost
#</Location>
#ExtendedStatus On
$| = 1;
$server = 'www.iso-ne.com';

# can return hits or bytes (counters)

@res = `lynx -dump http://www.iso-ne.com:80/server-status`;

foreach $res (@res) {
    if ($res =~ /Server uptime: (.*)$/) { $up = $1; last } else { next }
    if ($res =~ /Server at/) { $server = $res; last } else { next }
}

@res = `lynx -dump http://www.iso-ne.com:80/server-status?auto`;

foreach $res (@res) {
    if ($res =~ /Total Accesses: (\d+)/) { $d1 = $1; next }
    if ($res =~ /Total kBytes: (\d+)/) { $d2 = $1 * 1024; next }
}

$d1 = int($d1);
$d2 = int($d2);

if ($ARGV[0] eq "hits") {
    print "$d1\n";
    print "$d1\n";
} elsif ($ARGV[0] eq "bytes") {
    print "$d2\n";
    print "$d2\n";
}

print "$up\n";
print "$server";

Matt Soffen - Web Intranet Developer
http://www.iso-ne.com/

==============================================
Boss  - "My boss says we need some eunuch programmers."
Dilbert- "I think he means UNIX and I already know UNIX."
Boss  - "Well, if the company nurse comes by, tell her I said
             never mind."
                                 - Dilbert -
==============================================


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list