1 /*****************************************************************************
2 * RRDtool 1.2.99907080300 Copyright by Tobi Oetiker, 1997-2007
3 *****************************************************************************
4 * rrd_create.c creates new rrds
5 *****************************************************************************/
10 #include "rrd_rpncalc.h"
13 #include "rrd_is_thread_safe.h"
15 unsigned long FnvHash(
17 int create_hw_contingent_rras(
19 unsigned short period,
20 unsigned long hashed_name);
30 struct option long_options[] = {
31 {"start", required_argument, 0, 'b'},
32 {"step", required_argument, 0, 's'},
37 time_t last_up = time(NULL) - 10;
38 unsigned long pdp_step = 300;
39 struct rrd_time_value last_up_tv;
40 char *parsetime_error = NULL;
45 opterr = 0; /* initialize getopt */
48 opt = getopt_long(argc, argv, "b:s:", long_options, &option_index);
55 if ((parsetime_error = parsetime(optarg, &last_up_tv))) {
56 rrd_set_error("start time: %s", parsetime_error);
59 if (last_up_tv.type == RELATIVE_TO_END_TIME ||
60 last_up_tv.type == RELATIVE_TO_START_TIME) {
61 rrd_set_error("specifying time relative to the 'start' "
62 "or 'end' makes no sense here");
66 last_up = mktime(&last_up_tv.tm) +last_up_tv.offset;
68 if (last_up < 3600 * 24 * 365 * 10) {
70 ("the first entry to the RRD should be after 1980");
76 long_tmp = atol(optarg);
78 rrd_set_error("step size should be no less than one second");
86 rrd_set_error("unknown option '%c'", optopt);
88 rrd_set_error("unknown option '%s'", argv[optind - 1]);
93 rrd_set_error("need name of an rrd file to create");
96 rc = rrd_create_r(argv[optind],
98 argc - optind - 1, (const char **) (argv + optind + 1));
105 const char *filename,
106 unsigned long pdp_step,
115 char dummychar1[2], dummychar2[2];
116 unsigned short token_idx, error_flag, period = 0;
117 unsigned long hashed_name;
122 if ((rrd.stat_head = calloc(1, sizeof(stat_head_t))) == NULL) {
123 rrd_set_error("allocating rrd.stat_head");
129 if ((rrd.live_head = calloc(1, sizeof(live_head_t))) == NULL) {
130 rrd_set_error("allocating rrd.live_head");
135 /* set some defaults */
136 strcpy(rrd.stat_head->cookie, RRD_COOKIE);
137 strcpy(rrd.stat_head->version, RRD_VERSION3); /* by default we are still version 3 */
138 rrd.stat_head->float_cookie = FLOAT_COOKIE;
139 rrd.stat_head->ds_cnt = 0; /* this will be adjusted later */
140 rrd.stat_head->rra_cnt = 0; /* ditto */
141 rrd.stat_head->pdp_step = pdp_step; /* 5 minute default */
143 /* a default value */
147 rrd.live_head->last_up = last_up;
149 /* optind points to the first non-option command line arg,
150 * in this case, the file name. */
151 /* Compute the FNV hash value (used by SEASONAL and DEVSEASONAL
153 hashed_name = FnvHash(filename);
154 for (i = 0; i < argc; i++) {
157 if (strncmp(argv[i], "DS:", 3) == 0) {
158 size_t old_size = sizeof(ds_def_t) * (rrd.stat_head->ds_cnt);
160 if ((rrd.ds_def = rrd_realloc(rrd.ds_def,
161 old_size + sizeof(ds_def_t))) ==
163 rrd_set_error("allocating rrd.ds_def");
167 memset(&rrd.ds_def[rrd.stat_head->ds_cnt], 0, sizeof(ds_def_t));
168 /* extract the name and type */
169 switch (sscanf(&argv[i][3],
170 DS_NAM_FMT "%1[:]" DST_FMT "%1[:]%n",
171 rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
173 rrd.ds_def[rrd.stat_head->ds_cnt].dst,
174 dummychar2, &offset)) {
177 rrd_set_error("Invalid DS name");
181 rrd_set_error("Invalid DS type");
183 case 4: /* (%n may or may not be counted) */
184 case 5: /* check for duplicate datasource names */
185 for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++)
186 if (strcmp(rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
187 rrd.ds_def[ii].ds_nam) == 0)
188 rrd_set_error("Duplicate DS name: %s",
189 rrd.ds_def[ii].ds_nam);
190 /* DS_type may be valid or not. Checked later */
193 rrd_set_error("invalid DS format");
195 if (rrd_test_error()) {
200 /* parse the remainder of the arguments */
201 switch (dst_conv(rrd.ds_def[rrd.stat_head->ds_cnt].dst)) {
206 parseGENERIC_DS(&argv[i][offset + 3], &rrd,
207 rrd.stat_head->ds_cnt);
210 parseCDEF_DS(&argv[i][offset + 3], &rrd,
211 rrd.stat_head->ds_cnt);
214 rrd_set_error("invalid DS type specified");
218 if (rrd_test_error()) {
222 rrd.stat_head->ds_cnt++;
223 } else if (strncmp(argv[i], "RRA:", 4) == 0) {
226 size_t old_size = sizeof(rra_def_t) * (rrd.stat_head->rra_cnt);
228 if ((rrd.rra_def = rrd_realloc(rrd.rra_def,
229 old_size + sizeof(rra_def_t))) ==
231 rrd_set_error("allocating rrd.rra_def");
235 memset(&rrd.rra_def[rrd.stat_head->rra_cnt], 0,
238 argvcopy = strdup(argv[i]);
239 token = strtok_r(&argvcopy[4], ":", &tokptr);
240 token_idx = error_flag = 0;
241 while (token != NULL) {
244 if (sscanf(token, CF_NAM_FMT,
245 rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) !=
247 rrd_set_error("Failed to parse CF name");
249 (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
251 strcpy(rrd.stat_head->version, RRD_VERSION); /* MHWPREDICT causes Version 4 */
253 /* initialize some parameters */
254 rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].
256 rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].
258 rrd.rra_def[rrd.stat_head->rra_cnt].
259 par[RRA_dependent_rra_idx].u_cnt =
260 rrd.stat_head->rra_cnt;
264 /* initialize some parameters */
265 rrd.rra_def[rrd.stat_head->rra_cnt].
266 par[RRA_seasonal_gamma].u_val = 0.1;
267 rrd.rra_def[rrd.stat_head->rra_cnt].
268 par[RRA_seasonal_smoothing_window].u_val = 0.05;
271 rrd.rra_def[rrd.stat_head->rra_cnt].
272 par[RRA_dependent_rra_idx].u_cnt = -1;
275 rrd.rra_def[rrd.stat_head->rra_cnt].
276 par[RRA_delta_pos].u_val = 2.0;
277 rrd.rra_def[rrd.stat_head->rra_cnt].
278 par[RRA_delta_neg].u_val = 2.0;
279 rrd.rra_def[rrd.stat_head->rra_cnt].
280 par[RRA_window_len].u_cnt = 3;
281 rrd.rra_def[rrd.stat_head->rra_cnt].
282 par[RRA_failure_threshold].u_cnt = 2;
283 rrd.rra_def[rrd.stat_head->rra_cnt].
284 par[RRA_dependent_rra_idx].u_cnt = -1;
286 /* invalid consolidation function */
289 ("Unrecognized consolidation function %s",
290 rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
294 /* default: 1 pdp per cdp */
295 rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt = 1;
299 (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
306 rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt =
310 rrd.rra_def[rrd.stat_head->rra_cnt].
311 par[RRA_cdp_xff_val].u_val = atof(token);
312 if (rrd.rra_def[rrd.stat_head->rra_cnt].
313 par[RRA_cdp_xff_val].u_val < 0.0
314 || rrd.rra_def[rrd.stat_head->rra_cnt].
315 par[RRA_cdp_xff_val].u_val >= 1.0)
317 ("Invalid xff: must be between 0 and 1");
323 (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
326 rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].
328 if (atof(token) <= 0.0 || atof(token) >= 1.0)
330 ("Invalid alpha: must be between 0 and 1");
334 rrd.rra_def[rrd.stat_head->rra_cnt].
335 par[RRA_seasonal_gamma].u_val = atof(token);
336 if (atof(token) <= 0.0 || atof(token) >= 1.0)
338 ("Invalid gamma: must be between 0 and 1");
339 rrd.rra_def[rrd.stat_head->rra_cnt].
340 par[RRA_seasonal_smooth_idx].u_cnt =
342 rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt;
345 /* specifies the # of violations that constitutes the failure threshold */
346 rrd.rra_def[rrd.stat_head->rra_cnt].
347 par[RRA_failure_threshold].u_cnt = atoi(token);
349 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
351 ("Failure threshold is out of range %d, %d",
352 1, MAX_FAILURES_WINDOW_LEN);
355 /* specifies the index (1-based) of CF_DEVSEASONAL array
356 * associated with this CF_DEVPREDICT array. */
357 rrd.rra_def[rrd.stat_head->rra_cnt].
358 par[RRA_dependent_rra_idx].u_cnt =
362 rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt =
369 (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
372 rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].
374 if (atof(token) < 0.0 || atof(token) > 1.0)
376 ("Invalid beta: must be between 0 and 1");
380 /* specifies the index (1-based) of CF_HWPREDICT array
381 * associated with this CF_DEVSEASONAL or CF_SEASONAL array.
383 rrd.rra_def[rrd.stat_head->rra_cnt].
384 par[RRA_dependent_rra_idx].u_cnt =
388 /* specifies the window length */
389 rrd.rra_def[rrd.stat_head->rra_cnt].
390 par[RRA_window_len].u_cnt = atoi(token);
392 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
394 ("Window length is out of range %d, %d", 1,
395 MAX_FAILURES_WINDOW_LEN);
396 /* verify that window length exceeds the failure threshold */
397 if (rrd.rra_def[rrd.stat_head->rra_cnt].
398 par[RRA_window_len].u_cnt <
399 rrd.rra_def[rrd.stat_head->rra_cnt].
400 par[RRA_failure_threshold].u_cnt)
402 ("Window length is shorter than the failure threshold");
405 /* shouldn't be any more arguments */
407 ("Unexpected extra argument for consolidation function DEVPREDICT");
410 rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt =
417 (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
419 /* specifies the index (1-based) of CF_DEVSEASONAL array
420 * associated with this CF_DEVFAILURES array. */
421 rrd.rra_def[rrd.stat_head->rra_cnt].
422 par[RRA_dependent_rra_idx].u_cnt =
427 /* optional smoothing window */
428 if (sscanf(token, "smoothing-window=%lf",
429 &(rrd.rra_def[rrd.stat_head->rra_cnt].
430 par[RRA_seasonal_smoothing_window].
432 strcpy(rrd.stat_head->version, RRD_VERSION); /* smoothing-window causes Version 4 */
433 if (rrd.rra_def[rrd.stat_head->rra_cnt].
434 par[RRA_seasonal_smoothing_window].u_val < 0.0
435 || rrd.rra_def[rrd.stat_head->rra_cnt].
436 par[RRA_seasonal_smoothing_window].u_val >
439 ("Invalid smoothing-window %f: must be between 0 and 1",
440 rrd.rra_def[rrd.stat_head->rra_cnt].
441 par[RRA_seasonal_smoothing_window].
445 rrd_set_error("Invalid option %s", token);
450 /* length of the associated CF_SEASONAL and CF_DEVSEASONAL arrays. */
451 period = atoi(token);
453 rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt)
455 ("Length of seasonal cycle exceeds length of HW prediction array");
458 /* shouldn't be any more arguments */
460 ("Unexpected extra argument for consolidation function %s",
461 rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
466 /* If we are here, this must be a CF_HWPREDICT RRA.
467 * Specifies the index (1-based) of CF_SEASONAL array
468 * associated with this CF_HWPREDICT array. If this argument
469 * is missing, then the CF_SEASONAL, CF_DEVSEASONAL, CF_DEVPREDICT,
471 * arrays are created automatically. */
472 rrd.rra_def[rrd.stat_head->rra_cnt].
473 par[RRA_dependent_rra_idx].u_cnt = atoi(token) - 1;
476 /* should never get here */
477 rrd_set_error("Unknown error");
480 if (rrd_test_error()) {
481 /* all errors are unrecoverable */
486 token = strtok_r(NULL, ":", &tokptr);
492 "Creating RRA CF: %s, dep idx %lu, current idx %lu\n",
493 rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam,
494 rrd.rra_def[rrd.stat_head->rra_cnt].
495 par[RRA_dependent_rra_idx].u_cnt, rrd.stat_head->rra_cnt);
497 /* should we create CF_SEASONAL, CF_DEVSEASONAL, and CF_DEVPREDICT? */
498 if ((cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) ==
500 || cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) ==
502 && rrd.rra_def[rrd.stat_head->rra_cnt].
503 par[RRA_dependent_rra_idx].u_cnt == rrd.stat_head->rra_cnt) {
505 fprintf(stderr, "Creating HW contingent RRAs\n");
507 if (create_hw_contingent_rras(&rrd, period, hashed_name) ==
509 rrd_set_error("creating contingent RRA");
514 rrd.stat_head->rra_cnt++;
516 rrd_set_error("can't parse argument '%s'", argv[i]);
523 if (rrd.stat_head->rra_cnt < 1) {
524 rrd_set_error("you must define at least one Round Robin Archive");
529 if (rrd.stat_head->ds_cnt < 1) {
530 rrd_set_error("you must define at least one Data Source");
534 return rrd_create_fn(filename, &rrd);
537 void parseGENERIC_DS(
542 char minstr[DS_NAM_SIZE], maxstr[DS_NAM_SIZE];
548 temp = sscanf(def,"%lu:%18[^:]:%18[^:]",
549 &(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
552 old_locale = setlocale(LC_NUMERIC, "C");
553 if (sscanf(def, "%lu:%18[^:]:%18[^:]",
554 &(rrd->ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
555 minstr, maxstr) == 3) {
556 if (minstr[0] == 'U' && minstr[1] == 0)
557 rrd->ds_def[ds_idx].par[DS_min_val].u_val = DNAN;
559 rrd->ds_def[ds_idx].par[DS_min_val].u_val = atof(minstr);
561 if (maxstr[0] == 'U' && maxstr[1] == 0)
562 rrd->ds_def[ds_idx].par[DS_max_val].u_val = DNAN;
564 rrd->ds_def[ds_idx].par[DS_max_val].u_val = atof(maxstr);
566 if (!isnan(rrd->ds_def[ds_idx].par[DS_min_val].u_val) &&
567 !isnan(rrd->ds_def[ds_idx].par[DS_max_val].u_val) &&
568 rrd->ds_def[ds_idx].par[DS_min_val].u_val
569 >= rrd->ds_def[ds_idx].par[DS_max_val].u_val) {
570 rrd_set_error("min must be less than max in DS definition");
571 setlocale(LC_NUMERIC, old_locale);
575 rrd_set_error("failed to parse data source %s", def);
577 setlocale(LC_NUMERIC, old_locale);
580 /* Create the CF_DEVPREDICT, CF_DEVSEASONAL, CF_SEASONAL, and CF_FAILURES RRAs
581 * associated with a CF_HWPREDICT RRA. */
582 int create_hw_contingent_rras(
584 unsigned short period,
585 unsigned long hashed_name)
588 rra_def_t *current_rra;
590 /* save index to CF_HWPREDICT */
591 unsigned long hw_index = rrd->stat_head->rra_cnt;
593 /* advance the pointer */
594 (rrd->stat_head->rra_cnt)++;
595 /* allocate the memory for the 4 contingent RRAs */
596 old_size = sizeof(rra_def_t) * (rrd->stat_head->rra_cnt);
597 if ((rrd->rra_def = rrd_realloc(rrd->rra_def,
598 old_size + 4 * sizeof(rra_def_t))) ==
600 rrd_set_error("allocating rrd.rra_def");
604 memset(&(rrd->rra_def[rrd->stat_head->rra_cnt]), 0,
605 4 * sizeof(rra_def_t));
607 /* create the CF_SEASONAL RRA */
608 current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
609 strcpy(current_rra->cf_nam, "SEASONAL");
610 current_rra->row_cnt = period;
611 current_rra->par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
612 current_rra->pdp_cnt = 1;
613 current_rra->par[RRA_seasonal_gamma].u_val =
614 rrd->rra_def[hw_index].par[RRA_hw_alpha].u_val;
615 current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index;
616 rrd->rra_def[hw_index].par[RRA_dependent_rra_idx].u_cnt =
617 rrd->stat_head->rra_cnt;
619 /* create the CF_DEVSEASONAL RRA */
620 (rrd->stat_head->rra_cnt)++;
621 current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
622 strcpy(current_rra->cf_nam, "DEVSEASONAL");
623 current_rra->row_cnt = period;
624 current_rra->par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
625 current_rra->pdp_cnt = 1;
626 current_rra->par[RRA_seasonal_gamma].u_val =
627 rrd->rra_def[hw_index].par[RRA_hw_alpha].u_val;
628 current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index;
630 /* create the CF_DEVPREDICT RRA */
631 (rrd->stat_head->rra_cnt)++;
632 current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
633 strcpy(current_rra->cf_nam, "DEVPREDICT");
634 current_rra->row_cnt = (rrd->rra_def[hw_index]).row_cnt;
635 current_rra->pdp_cnt = 1;
636 current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index + 2; /* DEVSEASONAL */
638 /* create the CF_FAILURES RRA */
639 (rrd->stat_head->rra_cnt)++;
640 current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
641 strcpy(current_rra->cf_nam, "FAILURES");
642 current_rra->row_cnt = period;
643 current_rra->pdp_cnt = 1;
644 current_rra->par[RRA_delta_pos].u_val = 2.0;
645 current_rra->par[RRA_delta_neg].u_val = 2.0;
646 current_rra->par[RRA_failure_threshold].u_cnt = 7;
647 current_rra->par[RRA_window_len].u_cnt = 9;
648 current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index + 2; /* DEVSEASONAL */
652 /* create and empty rrd file according to the specs given */
655 const char *file_name,
660 rrd_value_t *unknown;
662 rrd_file_t *rrd_file_dn;
666 open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == NULL) {
667 rrd_set_error("creating '%s': %s", file_name, rrd_strerror(errno));
672 write(rrd_file, rrd->stat_head, sizeof(stat_head_t));
674 write(rrd_file, rrd->ds_def, sizeof(ds_def_t) * rrd->stat_head->ds_cnt);
676 write(rrd_file, rrd->rra_def,
677 sizeof(rra_def_t) * rrd->stat_head->rra_cnt);
679 write(rrd_file, rrd->live_head, sizeof(live_head_t));
681 if ((rrd->pdp_prep = calloc(1, sizeof(pdp_prep_t))) == NULL) {
682 rrd_set_error("allocating pdp_prep");
688 strcpy(rrd->pdp_prep->last_ds, "UNKN");
690 rrd->pdp_prep->scratch[PDP_val].u_val = 0.0;
691 rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt =
692 rrd->live_head->last_up % rrd->stat_head->pdp_step;
694 for (i = 0; i < rrd->stat_head->ds_cnt; i++)
695 write(rrd_file, rrd->pdp_prep, sizeof(pdp_prep_t));
697 if ((rrd->cdp_prep = calloc(1, sizeof(cdp_prep_t))) == NULL) {
698 rrd_set_error("allocating cdp_prep");
705 for (i = 0; i < rrd->stat_head->rra_cnt; i++) {
706 switch (cf_conv(rrd->rra_def[i].cf_nam)) {
709 init_hwpredict_cdp(rrd->cdp_prep);
713 init_seasonal_cdp(rrd->cdp_prep);
716 /* initialize violation history to 0 */
717 for (ii = 0; ii < MAX_CDP_PAR_EN; ii++) {
718 /* We can zero everything out, by setting u_val to the
719 * NULL address. Each array entry in scratch is 8 bytes
720 * (a double), but u_cnt only accessed 4 bytes (long) */
721 rrd->cdp_prep->scratch[ii].u_val = 0.0;
725 /* can not be zero because we don't know anything ... */
726 rrd->cdp_prep->scratch[CDP_val].u_val = DNAN;
727 /* startup missing pdp count */
728 rrd->cdp_prep->scratch[CDP_unkn_pdp_cnt].u_cnt =
729 ((rrd->live_head->last_up -
730 rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt)
731 % (rrd->stat_head->pdp_step
732 * rrd->rra_def[i].pdp_cnt)) / rrd->stat_head->pdp_step;
736 for (ii = 0; ii < rrd->stat_head->ds_cnt; ii++) {
737 write(rrd_file, rrd->cdp_prep, sizeof(cdp_prep_t));
741 /* now, we must make sure that the rest of the rrd
742 struct is properly initialized */
744 if ((rrd->rra_ptr = calloc(1, sizeof(rra_ptr_t))) == NULL) {
745 rrd_set_error("allocating rra_ptr");
751 /* changed this initialization to be consistent with
752 * rrd_restore. With the old value (0), the first update
753 * would occur for cur_row = 1 because rrd_update increments
754 * the pointer a priori. */
755 for (i = 0; i < rrd->stat_head->rra_cnt; i++) {
756 rrd->rra_ptr->cur_row = rrd->rra_def[i].row_cnt - 1;
757 write(rrd_file, rrd->rra_ptr, sizeof(rra_ptr_t));
760 /* write the empty data area */
761 if ((unknown = (rrd_value_t *) malloc(512 * sizeof(rrd_value_t))) == NULL) {
762 rrd_set_error("allocating unknown");
767 for (i = 0; i < 512; ++i)
771 for (i = 0; i < rrd->stat_head->rra_cnt; i++)
772 unkn_cnt += rrd->stat_head->ds_cnt * rrd->rra_def[i].row_cnt;
774 while (unkn_cnt > 0) {
775 write(rrd_file, unknown, sizeof(rrd_value_t) * min(unkn_cnt, 512));
782 if (close(rrd_file) == -1) {
783 rrd_set_error("creating rrd: %s", rrd_strerror(errno));
786 /* flush all we don't need out of the cache */
787 rrd_file_dn = rrd_open(file_name, &rrd_dn, RRD_READONLY);
788 rrd_dontneed(rrd_file_dn, &rrd_dn);
789 rrd_close(rrd_file_dn);