Defining RRA row counts for new RRD's created by MRTG - Patches enclosed

6 messages Options
Embed this post
Permalink
Chrisfu () Defining RRA row counts for new RRD's created by MRTG - Patches enclosed
Reply Threaded More More options
Print post
Permalink
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.

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! :)

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 ***
oetiker () Re: Defining RRA row counts for new RRD's created by MRTG - Patches enclosed
Reply Threaded More More options
Print post
Permalink
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 [hidden email] ++41 62 775 9902 / sb: -9900

_______________________________________________
mrtg-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers
oetiker () Re: Defining RRA row counts for new RRD's created by MRTG (docu missing!)
Reply Threaded More More options
Print post
Permalink
In reply to this post by Chrisfu
Chrisfu,

one thing though

Today Chrisfu wrote:
>
> *** 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;
[...]
> *** MRTG_lib.pm.patch END ***

please patch the mrtg-reference.pod too, so that others know of
these features as well :-)

cheers
tobi


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

_______________________________________________
mrtg-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers
Chrisfu () Re: Defining RRA row counts for new RRD's created by MRTG (docu missing!)
Reply Threaded More More options
Print post
Permalink

oetiker wrote:
Chrisfu,

one thing though

Today Chrisfu wrote:
>
> *** 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;
[...]
> *** MRTG_lib.pm.patch END ***

please patch the mrtg-reference.pod too, so that others know of
these features as well :-)

cheers
tobi
Hi Tobi,

Sure thing!  I'll submit the mrtg-reference patch when I arrive home tonight.  Also, thank you for your immensely quick reply. :)

Cheers,

Chris
Chrisfu () Re: Defining RRA row counts for new RRD's created by MRTG (docu missing!)
Reply Threaded More More options
Print post
Permalink
oetiker wrote:
Chrisfu,

one thing though

Today Chrisfu wrote:
>
> *** 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;
[...]
> *** MRTG_lib.pm.patch END ***

please patch the mrtg-reference.pod too, so that others know of
these features as well :-)

cheers
tobi
Hi Tobi,

As promised, here is the patch for mtrg-reference.pod.  Please let me know if this is suitable!

*** mrtg-reference.pod.patch BEGIN ***
--- mrtg-reference.pod.original 2009-05-05 17:34:54.000000000 +0100
+++ mrtg-reference.pod  2009-05-05 17:54:12.000000000 +0100
@@ -1765,6 +1765,36 @@

  RRDRowCount[myrouter]: 1600

+=head2 RRDRowCount30m
+
+As per RRDRowCount, but for the RRA's -typically- used for 30 minute data.
+Even so, you must still take the base interval into account.  Leaving out
+this keyword will force the old default of 800 rows.
+
+Example:
+
+ RRDRowCount30m[myrouter]: 800
+
+=head2 RRDRowCount2h
+
+As per RRDRowCount, but for the RRA's -typically- used for 2 hour data.
+Even so, you must still take the base interval into account.  Leaving out
+this keyword will force the old default of 800 rows.
+
+Example:
+
+ RRDRowCount2h[myrouter]: 400
+
+=head2 RRDRowCount1d
+
+As per RRDRowCount, but for the RRA's -typically- used for 1 day data.
+Even so, you must still take the base interval into account.  Leaving out
+this keyword will force the old default of 800 rows.
+
+Example:
+
+ RRDRowCount1d[myrouter]: 200
+
 =head2 RRDHWRRAs

 Normally the RRDs created by MRTG will just contain the information gathered
*** mrtg-reference.pod.patch END ***
oetiker () Re: Defining RRA row counts for new RRD's created by MRTG (docu missing!)
Reply Threaded More More options
Print post
Permalink
Hi Chris,

great ...  the patch is in svn now ...

cheers
tobi

Tuesday Chrisfu wrote:

>
>
> oetiker wrote:
> >
> > Chrisfu,
> >
> > one thing though
> >
> > Today Chrisfu wrote:
> >>
> >> *** 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;
> > [...]
> >> *** MRTG_lib.pm.patch END ***
> >
> > please patch the mrtg-reference.pod too, so that others know of
> > these features as well :-)
> >
> > cheers
> > tobi
> >
>
> Hi Tobi,
>
> As promised, here is the patch for mtrg-reference.pod.  Please let me know
> if this is suitable!
>
> *** mrtg-reference.pod.patch BEGIN ***
> --- mrtg-reference.pod.original 2009-05-05 17:34:54.000000000 +0100
> +++ mrtg-reference.pod  2009-05-05 17:54:12.000000000 +0100
> @@ -1765,6 +1765,36 @@
>
>   RRDRowCount[myrouter]: 1600
>
> +=head2 RRDRowCount30m
> +
> +As per RRDRowCount, but for the RRA's -typically- used for 30 minute data.
> +Even so, you must still take the base interval into account.  Leaving out
> +this keyword will force the old default of 800 rows.
> +
> +Example:
> +
> + RRDRowCount30m[myrouter]: 800
> +
> +=head2 RRDRowCount2h
> +
> +As per RRDRowCount, but for the RRA's -typically- used for 2 hour data.
> +Even so, you must still take the base interval into account.  Leaving out
> +this keyword will force the old default of 800 rows.
> +
> +Example:
> +
> + RRDRowCount2h[myrouter]: 400
> +
> +=head2 RRDRowCount1d
> +
> +As per RRDRowCount, but for the RRA's -typically- used for 1 day data.
> +Even so, you must still take the base interval into account.  Leaving out
> +this keyword will force the old default of 800 rows.
> +
> +Example:
> +
> + RRDRowCount1d[myrouter]: 200
> +
>  =head2 RRDHWRRAs
>
>  Normally the RRDs created by MRTG will just contain the information
> gathered
> *** mrtg-reference.pod.patch END ***
>
>

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

_______________________________________________
mrtg-developers mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers