[packages] collectd: update to v4.9.0 (#6390, #4704, #5936)
[openwrt/svn-archive/archive.git] / utils / collectd / patches / 100-rrdtool-add-rrasingle-option.patch
1 --- a/src/rrdtool.c
2 +++ b/src/rrdtool.c
3 @@ -80,6 +80,7 @@ static const char *config_keys[] =
4 "HeartBeat",
5 "RRARows",
6 "RRATimespan",
7 + "RRASingle",
8 "XFF",
9 "WritesPerSecond",
10 "RandomTimeout"
11 @@ -101,6 +102,8 @@ static rrdcreate_config_t rrdcreate_conf
12 /* timespans = */ NULL,
13 /* timespans_num = */ 0,
14
15 + /* rrasingle = */ 0,
16 +
17 /* consolidation_functions = */ NULL,
18 /* consolidation_functions_num = */ 0
19 };
20 @@ -975,6 +978,14 @@ static int rrd_config (const char *key,
21
22 free (value_copy);
23 }
24 + else if (strcasecmp ("RRASingle", key) == 0)
25 + {
26 + if (IS_TRUE (value))
27 + {
28 + rrdcreate_config.rrasingle = 1;
29 + NOTICE ("rrdtool plugin: RRASingle = true: creating only AVERAGE RRAs");
30 + }
31 + }
32 else if (strcasecmp ("XFF", key) == 0)
33 {
34 double tmp = atof (value);
35 --- a/src/utils_rrdcreate.c
36 +++ b/src/utils_rrdcreate.c
37 @@ -122,6 +122,9 @@ static int rra_get (char ***ret, const v
38 rts_num = rra_timespans_num;
39 }
40
41 + if (cfg->rrasingle)
42 + rra_types_num = 1;
43 +
44 rra_max = rts_num * rra_types_num;
45
46 if ((rra_def = (char **) malloc ((rra_max + 1) * sizeof (char *))) == NULL)
47 --- a/src/utils_rrdcreate.h
48 +++ b/src/utils_rrdcreate.h
49 @@ -36,6 +36,8 @@ struct rrdcreate_config_s
50 int *timespans;
51 size_t timespans_num;
52
53 + int rrasingle;
54 +
55 char **consolidation_functions;
56 size_t consolidation_functions_num;
57 };