示例#1
0
文件: statsd.c 项目: skolot/collectd
static int statsd_config_node (statsd_config_t *conf, 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->host);
    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 ("LeaveMetricsNameASIS", child->key) == 0)
      cf_util_get_boolean (child, &conf->leave_metrics_name_asis);
    else if (strcasecmp ("GlobalPrefix", child->key) == 0)
      cf_util_get_string (child, &conf->global_prefix);
    else if (strcasecmp ("CounterPrefix", child->key) == 0)
      cf_util_get_string (child, &conf->counter_prefix);
    else if (strcasecmp ("TimerPrefix", child->key) == 0)
      cf_util_get_string (child, &conf->timer_prefix);
    else if (strcasecmp ("GaugePrefix", child->key) == 0)
      cf_util_get_string (child, &conf->gauge_prefix);
    else if (strcasecmp ("SetPrefix", child->key) == 0)
      cf_util_get_string (child, &conf->set_prefix);
    else if (strcasecmp ("GlobalPostfix", child->key) == 0)
      cf_util_get_string (child, &conf->global_postfix);
    else if (strcasecmp ("TimerPercentile", child->key) == 0)
      statsd_config_timer_percentile (conf, child);
    else
      ERROR ("statsd plugin: The \"%s\" config option is not valid.",
             child->key);
  }

  return (0);
}
示例#2
0
文件: statsd.c 项目: beorn-/collectd
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 ("CounterSum", child->key) == 0)
      cf_util_get_boolean (child, &conf_counter_sum);
    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 */