+ break;
+ case 2:
+ switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+ {
+ case CF_HWPREDICT:
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].u_val = atof(token);
+ if (atof(token) <= 0.0 || atof(token) >= 1.0)
+ rrd_set_error("Invalid alpha: must be between 0 and 1");
+ break;
+ case CF_DEVSEASONAL:
+ case CF_SEASONAL:
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_gamma].u_val =
+ atof(token);
+ if (atof(token) <= 0.0 || atof(token) >= 1.0)
+ rrd_set_error("Invalid gamma: must be between 0 and 1");
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_smooth_idx].u_cnt
+ = hashed_name % rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt;
+ break;
+ case CF_FAILURES:
+ /* specifies the # of violations that constitutes the failure threshold */
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt =
+ atoi(token);
+ if (atoi(token) < 1 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
+ rrd_set_error("Failure threshold is out of range %d, %d",1,
+ MAX_FAILURES_WINDOW_LEN);
+ break;
+ case CF_DEVPREDICT:
+ /* specifies the index (1-based) of CF_DEVSEASONAL array
+ * associated with this CF_DEVPREDICT array. */
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+ atoi(token) - 1;
+ break;
+ default:
+ rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt = atoi(token);
+ break;
+ }
+ break;
+ case 3:
+ switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+ {
+ case CF_HWPREDICT:
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].u_val = atof(token);
+ if (atof(token) < 0.0 || atof(token) > 1.0)
+ rrd_set_error("Invalid beta: must be between 0 and 1");
+ break;
+ case CF_DEVSEASONAL:
+ case CF_SEASONAL:
+ /* specifies the index (1-based) of CF_HWPREDICT array
+ * associated with this CF_DEVSEASONAL or CF_SEASONAL array.
+ * */
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+ atoi(token) - 1;
+ break;
+ case CF_FAILURES:
+ /* specifies the window length */
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt =
+ atoi(token);
+ if (atoi(token) < 1 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
+ rrd_set_error("Window length is out of range %d, %d",1,
+ MAX_FAILURES_WINDOW_LEN);
+ /* verify that window length exceeds the failure threshold */
+ if (rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt <
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt)
+ rrd_set_error("Window length is shorter than the failure threshold");
+ break;
+ case CF_DEVPREDICT:
+ /* shouldn't be any more arguments */
+ rrd_set_error("Unexpected extra argument for consolidation function DEVPREDICT");
+ break;
+ default:
+ rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt = atoi(token);
+ break;
+ }
+ break;
+ case 4:
+ switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+ {
+ case CF_FAILURES:
+ /* specifies the index (1-based) of CF_DEVSEASONAL array
+ * associated with this CF_DEVFAILURES array. */
+ rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+ atoi(token) - 1;
+ break;
+ case CF_HWPREDICT:
+ /* length of the associated CF_SEASONAL and CF_DEVSEASONAL arrays. */
+ period = atoi(token);
+ if (period > rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt)
+ rrd_set_error("Length of seasonal cycle exceeds length of HW prediction array");
+ 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 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;
+ break;
+ default:
+ /* should never get here */
+ rrd_set_error("Unknown error");
+ break;
+ } /* end switch */
+ if (rrd_test_error())
+ {
+ /* all errors are unrecoverable */