+static int statsd_config_timer_percentile (oconfig_item_t *ci) /* {{{ */
+{
+ double percent = NAN;
+ double *tmp;
+ int status;
+
+ status = cf_util_get_double (ci, &percent);
+ if (status != 0)
+ return (status);
+
+ if ((percent <= 0.0) || (percent >= 100))
+ {
+ ERROR ("statsd plugin: The value for \"%s\" must be between 0 and 100, "
+ "exclusively.", ci->key);
+ return (ERANGE);
+ }
+
+ tmp = realloc (conf_timer_percentile,
+ sizeof (*conf_timer_percentile) * (conf_timer_percentile_num + 1));
+ if (tmp == NULL)
+ {
+ ERROR ("statsd plugin: realloc failed.");
+ return (ENOMEM);
+ }
+ conf_timer_percentile = tmp;
+ conf_timer_percentile[conf_timer_percentile_num] = percent;
+ conf_timer_percentile_num++;
+
+ return (0);
+} /* }}} int statsd_config_timer_percentile */
+
+static int statsd_config (oconfig_item_t *ci) /* {{{ */
+{
+ int i;
+
+ for (i = 0; i < ci->children_num; i++)
+ {
+ oconfig_item_t *child = ci->children + i;
+
+ if (strcasecmp ("Host", child->key) == 0)
+ cf_util_get_string (child, &conf_node);
+ else if (strcasecmp ("Port", child->key) == 0)
+ cf_util_get_service (child, &conf_service);
+ else if (strcasecmp ("DeleteCounters", child->key) == 0)
+ cf_util_get_boolean (child, &conf_delete_counters);
+ else if (strcasecmp ("DeleteTimers", child->key) == 0)
+ cf_util_get_boolean (child, &conf_delete_timers);
+ else if (strcasecmp ("DeleteGauges", child->key) == 0)
+ cf_util_get_boolean (child, &conf_delete_gauges);
+ else if (strcasecmp ("DeleteSets", child->key) == 0)
+ cf_util_get_boolean (child, &conf_delete_sets);
+ else if (strcasecmp ("TimerLower", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_lower);
+ else if (strcasecmp ("TimerUpper", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_upper);
+ else if (strcasecmp ("TimerSum", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_sum);
+ else if (strcasecmp ("TimerCount", child->key) == 0)
+ cf_util_get_boolean (child, &conf_timer_count);
+ else if (strcasecmp ("TimerPercentile", child->key) == 0)
+ statsd_config_timer_percentile (child);
+ else
+ ERROR ("statsd plugin: The \"%s\" config option is not valid.",
+ child->key);
+ }
+
+ return (0);
+} /* }}} int statsd_config */
+