Permalink
Browse files

Attempt to implement DERIVE data source type through additional slope…

… type.
  • Loading branch information...
1 parent 9db9bee commit 3ea95e03681306b712aa6df5ae14ba7efe5bd538 @jbuchbinder jbuchbinder committed Apr 4, 2012
Showing with 16 additions and 5 deletions.
  1. +4 −0 gmetad/rrd_helpers.c
  2. +3 −3 gmetric/cmdline.h
  3. +1 −1 gmetric/cmdline.sh
  4. +2 −1 include/ganglia.h
  5. +6 −0 lib/libgmond.c
View
@@ -90,6 +90,10 @@ RRD_create( char *rrd, int summary, unsigned int step,
data_source_type = "COUNTER";
break;
+ case GANGLIA_SLOPE_DERIVATIVE:
+ data_source_type = "DERIVE";
+ break;
+
case GANGLIA_SLOPE_ZERO:
case GANGLIA_SLOPE_NEGATIVE:
case GANGLIA_SLOPE_BOTH:
View
@@ -54,9 +54,9 @@ struct gengetopt_args_info
char * units_arg; /**< @brief Unit of measure for the value e.g. Kilobytes, Celcius (default=''). */
char * units_orig; /**< @brief Unit of measure for the value e.g. Kilobytes, Celcius original value given at command line. */
const char *units_help; /**< @brief Unit of measure for the value e.g. Kilobytes, Celcius help description. */
- char * slope_arg; /**< @brief Either zero|positive|negative|both (default='both'). */
- char * slope_orig; /**< @brief Either zero|positive|negative|both original value given at command line. */
- const char *slope_help; /**< @brief Either zero|positive|negative|both help description. */
+ char * slope_arg; /**< @brief Either zero|positive|negative|both|derivative (default='both'). */
+ char * slope_orig; /**< @brief Either zero|positive|negative|both|derivative original value given at command line. */
+ const char *slope_help; /**< @brief Either zero|positive|negative|both|derivative help description. */
int tmax_arg; /**< @brief The maximum time in seconds between gmetric calls (default='60'). */
char * tmax_orig; /**< @brief The maximum time in seconds between gmetric calls original value given at command line. */
const char *tmax_help; /**< @brief The maximum time in seconds between gmetric calls help description. */
View
@@ -10,7 +10,7 @@ option "name" n "Name of the metric" string no
option "value" v "Value of the metric" string no
option "type" t "Either string|int8|uint8|int16|uint16|int32|uint32|float|double" string no
option "units" u "Unit of measure for the value e.g. Kilobytes, Celcius" string default="" no
-option "slope" s "Either zero|positive|negative|both" string default="both" no
+option "slope" s "Either zero|positive|negative|both|derivative" string default="both" no
option "tmax" x "The maximum time in seconds between gmetric calls" int default="60" no
option "dmax" d "The lifetime in seconds of this metric" int default="0" no
option "group" g "Group of the metric" string no
View
@@ -20,7 +20,8 @@ enum ganglia_slope {
GANGLIA_SLOPE_POSITIVE,
GANGLIA_SLOPE_NEGATIVE,
GANGLIA_SLOPE_BOTH,
- GANGLIA_SLOPE_UNSPECIFIED
+ GANGLIA_SLOPE_UNSPECIFIED,
+ GANGLIA_SLOPE_DERIVATIVE
};
typedef enum ganglia_slope ganglia_slope_t;
View
@@ -703,6 +703,10 @@ ganglia_slope_t cstr_to_slope(const char* str)
return GANGLIA_SLOPE_BOTH;
}
+ if (!strcmp(str, "derivative")) {
+ return GANGLIA_SLOPE_DERIVATIVE;
+ }
+
/*
* well, it might just be _wrong_ too
* but we'll handle that situation another time
@@ -726,6 +730,8 @@ const char* slope_to_cstr(unsigned int slope)
return "negative";
case GANGLIA_SLOPE_BOTH:
return "both";
+ case GANGLIA_SLOPE_DERIVATIVE:
+ return "derivative";
case GANGLIA_SLOPE_UNSPECIFIED:
return "unspecified";
}

0 comments on commit 3ea95e0

Please sign in to comment.