[mrtg] Re: Patching mrtg for 95th Percentile Integration

Barry_Young at interliant.com Barry_Young at interliant.com
Tue Dec 17 19:04:22 MET 2002



Mitchell (& any other interested parties),

Glad to be of service.....please find the relevant "patched" areas of mrtg
v2.9.22 code to integrate the data collected by the 95.pl script.  I do not
guarantee this to be the same for all versions of mrtg code, but the
philosophy should remain the same.

I would suggest you search for the appropriate areas of mrtg code and
compare the differences before patching.  As always, please take a backup
of your code and not not hold me responsible if it doesn't work (thanks).

- - - - - Declare additional variables that will be used - - - - - - -
sub writehtml {
    my($router, $cfg, $rcfg, $maxin, $maxout, $maxpercent,
       $avin, $avout, $avmxin, $avmxout, $avpercent,
       $cuin, $cuout, $cupercent, $uptime, $name, $LOC) = @_;

    my($VERSION,$Today,$peri,$nf);

    my($persec);

- - - - - Open the 'target'.95 file when creating the html file - - - - -
- - - - - Note: this assumes the .95 file exists in the same directory as
the html file
    $Today=&$LOC(datestr(time));
    $VERSION = "2.9.22";
        open NF, "$$cfg{'workdir'}${main::SL}$$rcfg{'directory'}
{$router}$router.95";
        $nf=<NF>;
    open (HTML,">$$cfg{'htmldir'}$$rcfg{'directory'}{$router}$router.$$rcfg
{'extension'}{$router}") ||
      do { warn ("WARNING: Writing $router.$$rcfg{'extension'}{$router}:
$!");
               next };
    print HTML "<!-- Begin Head -->\n";

- - - - - Include 95th percentile stats in the html page - - - - -
    print HTML
      &$LOC("The statistics were last updated <B>$Today</B>");
    }
    if ($uptime && ! $$rcfg{options}{noinfo}{$router}) {
        print HTML
          ",<BR>\n".
        &$LOC("at which time $namestring had been up for <B>$uptime</B>.").
        "<br><font color=red>Last 30 days usage (95th percentile): $nf
kb/sec</font>".
        "\n<!-- End Head -->";
    }

Feel free to modified the text to be displayed in the html page as
appropriate.

Hope this works for you.

Regards,


--
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