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