[rrd-developers] [PATCH] set smoothing window

Tobias Oetiker tobi at oetiker.ch
Wed Sep 15 14:59:10 CEST 2010


Hoi Pawel,

Monday Pawel 'Reef' Polewicz wrote:

>
> Similar to Evan Miller's patch, here comes the one that lets users set
> confidence bounds scaling parameters ("deltaneg" and "deltapos") when
> creating a FAILURES RRA explicitly. The parameters can be different for each
> RRA that is being created. Until now, both were set by default to "2.0".
> As far as I know, there was no way of setting this parameter that didn't
> involve exporting rrd to xml and back (or possibly using a third party
> (hex)editor).
> rrdtune can only change the first deltaneg/deltapos parameter in the given
> RRD, so if someone (like me) has multiple data sources or multiple sets of
> Aberrant Behavior Detection RRAs per his datasource, he cannot set the delta
> parameters, without resorting to drastic measures mentioned above.
>
> Old format:
> RRA:FAILURES:rows:threshold:window length:rra-num
>
> New (backward-compatible (i hope)) format:
> RRA:FAILURES:rows:threshold:window length:rra-num[:deltaneg][:deltapos]

looks fine by me, except for the interface, to not proliverate on
positional arguments any further, I would like to see named
arguments for future enhancements (see rrd_graph DEF for
inspiration)

so this would have to be  RRA:FAILURES:rows:threshold:window length:rra-num[:delteneg=x][:deltapos=y]

with that I will be glad to include your patch into trunk.

cheers
tobi


> patch against current trunk:
>
> Index: rrd_create.c
> ===================================================================
> --- rrd_create.c	(revision 2129)
> +++ rrd_create.c	(working copy)
> @@ -485,18 +485,55 @@
>                      }
>                      break;
>                  case 5:
> -                    /* If we are here, this must be a CF_HWPREDICT RRA.
> -                     * Specifies the index (1-based) of CF_SEASONAL array
> -                     * associated with this CF_HWPREDICT array. If this
> argument
> -                     * is missing, then the CF_SEASONAL, CF_DEVSEASONAL,
> CF_DEVPREDICT,
> -                     * CF_FAILURES.
> -                     * arrays are created automatically. */
> -                    rrd.rra_def[rrd.stat_head->rra_cnt].
> -                        par[RRA_dependent_rra_idx].u_cnt = atoi(token) - 1;
> +                    switch (cf_conv
> +                            (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
> +                    case CF_HWPREDICT:
> +                        /* Specifies the index (1-based) of CF_SEASONAL
> array
> +                         * associated with this CF_HWPREDICT array. If this
> argument
> +                         * is missing, then the CF_SEASONAL,
> CF_DEVSEASONAL, CF_DEVPREDICT,
> +                         * CF_FAILURES arrays are created automatically. */
> +                        rrd.rra_def[rrd.stat_head->rra_cnt].
> +                            par[RRA_dependent_rra_idx].u_cnt = atoi(token)
> - 1;
> +                        break;
> +                    case CF_FAILURES:
> +                        /* Specifies deltaneg parameter */
> +
> +                        if (atof(token) < 0.1) {
> +                            rrd_set_error("Deltaneg parameter specified is
> too small");
> +                        }
> +
> rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_delta_neg].u_val = atof(token);
> +                        break;
> +                    default:
> +                        /* shouldn't be any more arguments */
> +                        rrd_set_error
> +                            ("Unexpected extra argument for consolidation
> function %s",
> +                             rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
> +                        break;
> +                    }
>                      break;
> +                case 6:
> +                    switch (cf_conv
> +                            (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
> +                    case CF_FAILURES:
> +                        /* Specifies deltapos parameter */
> +                        if (atof(token) < 0.1) {
> +                            rrd_set_error("Deltapos parameter specified is
> too small");
> +                        }
> +
> rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_delta_pos].u_val = atof(token);
> +                        break;
> +                    default:
> +                        /* shouldn't be any more arguments */
> +                        rrd_set_error
> +                            ("Unexpected extra argument for consolidation
> function %s",
> +                             rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
> +                        break;
> +                    }
> +                    break;
>                  default:
>                      /* should never get here */
> -                    rrd_set_error("Unknown error");
> +                    rrd_set_error
> +                        ("Unexpected extra argument for consolidation
> function %s",
> +                         rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
>                      break;
>                  }       /* end switch */
>                  if (rrd_test_error()) {
>
>
> Best regards
> Pawel 'Reef' Polewicz
>
>

-- 
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 rrd-developers mailing list