summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5c54fc8)
raw | patch | inline | side by side (parent: 5c54fc8)
author | Florian Forster <octo@huhu.verplant.org> | |
Thu, 19 Apr 2007 19:10:30 +0000 (21:10 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Thu, 19 Apr 2007 19:10:30 +0000 (21:10 +0200) |
src/collectd.conf.pod | patch | blob | history | |
src/rrdtool.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 07a49cc56919f83bd9998aeb1a4c34ddb448efd0..da50a346b9d7df78903e72f125ae74df28796ee1 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Bottom line is, set this no smaller than the width of you graphs in pixels. The
default is 1200.
+=item B<RRATimespan> I<Seconds>
+
+Adds an RRA-timespan, given in seconds. Use this option mulitple times to have
+more then one RRA. If this option is never used, the built-in default of (3600,
+86400, 604800, 2678400, 31622400) is used.
+
+For more information on how RRA-sizes are calculated see B<RRARows> above.
+
=item B<XFF> I<Factor>
Set the "XFiles Factor". The default is 0.1. If unsure, don't set this option.
diff --git a/src/rrdtool.c b/src/rrdtool.c
index b221341ca4925e002b099381cf960f1bf5d4eb58..814b3e390f137fea1009260667329433686516ef 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
};
static int rra_timespans_num = STATIC_ARRAY_SIZE (rra_timespans);
+static int *rra_timespans_custom = NULL;
+static int rra_timespans_custom_num = 0;
+
static char *rra_types[] =
{
"AVERAGE",
"StepSize",
"HeartBeat",
"RRARows",
+ "RRATimespan",
"XFF"
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
static char **rra_def = NULL;
static int rra_num = 0;
- int rra_max = rra_timespans_num * rra_types_num;
+ int *rts;
+ int rts_num;
+
+ int rra_max;
int span;
return (rra_num);
}
+ /* Use the configured timespans or fall back to the built-in defaults */
+ if (rra_timespans_custom_num != 0)
+ {
+ rts = rra_timespans_custom;
+ rts_num = rra_timespans_custom_num;
+ }
+ else
+ {
+ rts = rra_timespans;
+ rts_num = rra_timespans_num;
+ }
+
+ rra_max = rts_num * rra_types_num;
+
if ((rra_def = (char **) malloc ((rra_max + 1) * sizeof (char *))) == NULL)
return (-1);
memset (rra_def, '\0', (rra_max + 1) * sizeof (char *));
}
cdp_len = 0;
- for (i = 0; i < rra_timespans_num; i++)
+ for (i = 0; i < rts_num; i++)
{
- span = rra_timespans[i];
+ span = rts[i];
if ((span / stepsize) < rrarows)
continue;
}
rrarows = tmp;
}
+ else if (strcasecmp ("RRATimespan", key) == 0)
+ {
+ char *saveptr = NULL;
+ char *dummy;
+ char *ptr;
+ int *tmp_alloc;
+
+ dummy = value;
+ while ((ptr = strtok_r (dummy, ", \t", &saveptr)) != NULL)
+ {
+ dummy = NULL;
+
+ tmp_alloc = realloc (rra_timespans_custom,
+ sizeof (int) * (rra_timespans_custom_num + 1));
+ if (tmp_alloc == NULL)
+ {
+ fprintf (stderr, "rrdtool: realloc failed.\n");
+ return (1);
+ }
+ rra_timespans_custom = tmp_alloc;
+ rra_timespans_custom[rra_timespans_custom_num] = atoi (ptr);
+ if (rra_timespans_custom[rra_timespans_custom_num] != 0)
+ rra_timespans_custom_num++;
+ } /* while (strtok_r) */
+
+ }
else if (strcasecmp ("XFF", key) == 0)
{
double tmp = atof (value);