1
0

100-rrdtool-add-rrasingle-option.patch 1.3 KB

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