[mrtg-developers] Defining RRA row counts for new RRD's created by MRTG - Patches enclosed

Tobias Oetiker tobi at oetiker.ch
Tue May 5 18:14:45 CEST 2009


Hi Chrisfu,

Today Chrisfu wrote:

>
> Hi guys,
>
> I'm a first time poster working as a developer for a hosting company based
> in Manchester, UK.  I've been lurking around for a while but have only
> subscribed today.
>
> I've been tasked with moving some of our Windows-based internal systems over
> to *nix-based platforms, and the time has come to migrate from PRTG (spit)
> to MRTG w/ RRDTool.  One of the main problems I encountered during my
> initial research involved low-resolution data storage, and the fact that
> MRTG doesn't output RRD's with user-definable row counts for
> lower-resolution RRA's.  Setting 5-min row counts via cfgmaker was fine via
> RRDRowCount[], but no such options exist for 30 minute, 2 hour and 1 day.
>
> When setting an RRDRowCount of 17856 (62 days of 5 minute data), this some
> what makes the default 30 minute and 2 hour RRA's redundant, as they'd be
> storing much less data with just 800 rows.
>
> As a result, I am submitting a patch for the main mrtg script and
> MRTG_lib.pm to allow for three new config options to compliment the existing
> RRDRowCount option.  These are:
>
> RRDRowCount30m
> RRDRowCount2h
> RRDRowCount1d
>
> These options are passed to cfgmaker with the --global parameter just as
> before.  If not passed as options, they simply default to 800 so as to not
> break MRTG's current behavior.  I'm not entirely sure if there is any reason
> why these options have not been included in the past, but I certainly feel
> there is justifiable reason for them to be considered for inclusion in the
> next release of MRTG.

by all means ... they were just not included because mrtg
development is more evolution than intelligent design these days :-)

> If anybody wishes to make any changes to the patches below, please feel free
> to make any such changes and repost them to the mailing list.
>
> Finally, thanks go out to Tobi and all the other hard-working contributors
> for making MRTG so flexible and friendly! :)

your patch will be in the next  update

cheers
tobi


> Cheers,
>
> Chris M
>
> *** mrtg.patch BEGIN ***
> --- mrtg.original       2009-05-05 15:12:15.000000000 +0100
> +++ mrtg        2009-05-05 15:23:02.000000000 +0100
> @@ -815,17 +815,20 @@
>              my $minhb = int($$cfg{interval} * 60)*2;
>              $minhb = 600 if ($minhb <600);
>              my $rows = $$rcfg{'rrdrowcount'}{$router} || int( 4000 /
> $interval);
> +            my $rows30m = $$rcfg{'rrdrowcount30m'}{$router} || 800;
> +            my $rows2h = $$rcfg{'rrdrowcount2h'}{$router} || 800;
> +            my $rows1d = $$rcfg{'rrdrowcount1d'}{$router} || 800;
>              my @args = ($dotrrd, '-b', $time-10, '-s', int($interval * 60),
>                           "DS:ds0:$up_abs:$minhb:0:$absi",
>                           "DS:ds1:$up_abs:$minhb:0:$abso",
>                           "RRA:AVERAGE:0.5:1:$rows",
> -                         ( $interval < 30  ?
> ("RRA:AVERAGE:0.5:".int(30/$interval).":800"):()),
> -                         "RRA:AVERAGE:0.5:".int(120/$interval).":800",
> -                         "RRA:AVERAGE:0.5:".int(1440/$interval).":800",
> +                         ( $interval < 30  ?
> ("RRA:AVERAGE:0.5:".int(30/$interval).":".$rows30m):()),
> +                         "RRA:AVERAGE:0.5:".int(120/$interval).":".$rows2h,
> +
> "RRA:AVERAGE:0.5:".int(1440/$interval).":".$rows1d,
>                           "RRA:MAX:0.5:1:$rows",
> -                         ( $interval < 30  ?
> ("RRA:MAX:0.5:".int(30/$interval).":800"):()),
> -                         "RRA:MAX:0.5:".int(120/$interval).":800",
> -                         "RRA:MAX:0.5:".int(1440/$interval).":800");
> +                         ( $interval < 30  ?
> ("RRA:MAX:0.5:".int(30/$interval).":".$rows30m):()),
> +                         "RRA:MAX:0.5:".int(120/$interval).":".$rows2h,
> +                         "RRA:MAX:0.5:".int(1440/$interval).":".$rows1d);
>              # do we have holt winters rras defined here ?
>              if (defined $$rcfg{'rrdhwrras'} and defined
> $$rcfg{'rrdhwrras'}{$router}){
>                  push @args, split(/\s+/, $$rcfg{'rrdhwrras'}{$router});
> *** mrtg.patch END ***
>
> *** MRTG_lib.pm.patch BEGIN ***
> --- MRTG_lib.pm.original        2009-05-05 15:17:37.000000000 +0100
> +++ MRTG_lib.pm 2009-05-05 15:18:17.000000000 +0100
> @@ -215,6 +215,15 @@
>         'rrdrowcount[]' =>
>         [sub{1}, sub{"Internal Error"}], #what ever the user chooses.
>
> +       'rrdrowcount30m[]' =>
> +       [sub{1}, sub{"Internal Error"}], #what ever the user chooses.
> +
> +       'rrdrowcount2h[]' =>
> +       [sub{1}, sub{"Internal Error"}], #what ever the user chooses.
> +
> +       'rrdrowcount1d[]' =>
> +       [sub{1}, sub{"Internal Error"}], #what ever the user chooses.
> +
>         'rrdhwrras[]' =>
>         [sub{$_[0] =~
> /^RRA:(HWPREDICT|SEASONAL|DEVPREDICT|DEVSEASONAL|FAILURES):\S+(\s+RRA:(HWPREDICT|SEASONAL|DEVPREDICT|DEVSEASONAL|FAILURES):\S+)*$/},
>          sub{"This does not look like rrdtool HW RRAs. Check the rrdcreate
> manual page for inspiration. ($_[0])"}],
> *** MRTG_lib.pm.patch END ***
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the mrtg-developers mailing list