[rrd-developers] [PATCH] set smoothing window

Pawel 'Reef' Polewicz reefiasty at gmail.com
Mon Sep 13 17:15:47 CEST 2010


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]

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

-- 
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/PATCH-set-smoothing-window-tp1060142p5526698.html
Sent from the RRDtool Developers Mailinglist mailing list archive at Nabble.com.



More information about the rrd-developers mailing list