--- a/src/rrdtool.c Fri Jan 2 22:39:55 2009 +++ b/src/rrdtool.c Tue Jan 20 12:04:06 2009 @@ -95,6 +98,7 @@ "HeartBeat", "RRARows", "RRATimespan", + "RRAType", "XFF", "WritesPerSecond" }; @@ -1262,6 +1279,29 @@ free (value_copy); } + else if (strcasecmp ("RRAType", key) == 0) + { + char *value_copy; + char **tmp_alloc; + + value_copy = strdup (value); + if (value_copy == NULL) + return (1); + + + tmp_alloc = realloc (rra_types_custom, + sizeof (char *) * (rra_types_custom_num + 1)); + if (tmp_alloc == NULL) + { + fprintf (stderr, "rrdtool: realloc failed.\n"); + free (value_copy); + return (1); + } + rra_types_custom = tmp_alloc; + rra_types_custom[rra_types_custom_num] = value_copy; + rra_types_custom_num++; + + } else if (strcasecmp ("XFF", key) == 0) { double tmp = atof (value); --- a/src/utils_rrdcreate.c 2014-05-07 11:34:23.320713960 +0200 +++ b/src/utils_rrdcreate.c 2014-05-07 11:40:05.465002124 +0200 @@ -47,6 +47,9 @@ static char *rra_types[] = }; static int rra_types_num = STATIC_ARRAY_SIZE (rra_types); +char **rra_types_custom = NULL; +int rra_types_custom_num = 0; + #if !defined(HAVE_THREADSAFE_LIBRRD) || !HAVE_THREADSAFE_LIBRRD static pthread_mutex_t librrd_lock = PTHREAD_MUTEX_INITIALIZER; #endif @@ -76,6 +79,8 @@ static int rra_get (char ***ret, const v int *rts; int rts_num; + char **rtp; + int rtp_num; int rra_max; @@ -123,6 +128,15 @@ static int rra_get (char ***ret, const v } rra_max = rts_num * rra_types_num; + if (rra_types_custom_num != 0) { + rtp = rra_types_custom; + rtp_num = rra_types_custom_num; + } else { + rtp = rra_types; + rtp_num = rra_types_num; + } + + rra_max = rts_num * rtp_num; if ((rra_def = (char **) malloc ((rra_max + 1) * sizeof (char *))) == NULL) return (-1); @@ -146,7 +160,7 @@ static int rra_get (char ***ret, const v cdp_num = (int) ceil (((double) span) / ((double) (cdp_len * ss))); - for (j = 0; j < rra_types_num; j++) + for (j = 0; j < rtp_num; j++) { int status; @@ -154,7 +168,7 @@ static int rra_get (char ***ret, const v break; status = ssnprintf (buffer, sizeof (buffer), "RRA:%s:%.10f:%u:%u", - rra_types[j], cfg->xff, cdp_len, cdp_num); + rtp[j], cfg->xff, cdp_len, cdp_num); if ((status < 0) || ((size_t) status >= sizeof (buffer))) { --- a/src/utils_rrdcreate.h 2014-05-07 11:54:07.459399080 +0200 +++ b/src/utils_rrdcreate.h 2014-05-07 11:54:38.031770860 +0200 @@ -26,6 +26,9 @@ #include +extern char **rra_types_custom; +extern int rra_types_custom_num; + struct rrdcreate_config_s { int stepsize;