本文整理汇总了C++中cf_util_get_boolean函数的典型用法代码示例。如果您正苦于以下问题:C++ cf_util_get_boolean函数的具体用法?C++ cf_util_get_boolean怎么用?C++ cf_util_get_boolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cf_util_get_boolean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rc_config
static int rc_config(oconfig_item_t *ci) {
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t const *child = ci->children + i;
const char *key = child->key;
int status = 0;
if (strcasecmp("DataDir", key) == 0) {
status = cf_util_get_string(child, &datadir);
if (status == 0) {
int len = strlen(datadir);
while ((len > 0) && (datadir[len - 1] == '/')) {
len--;
datadir[len] = 0;
}
if (len <= 0)
sfree(datadir);
}
} else if (strcasecmp("DaemonAddress", key) == 0)
status = cf_util_get_string(child, &daemon_address);
else if (strcasecmp("CreateFiles", key) == 0)
status = cf_util_get_boolean(child, &config_create_files);
else if (strcasecmp("CreateFilesAsync", key) == 0)
status = cf_util_get_boolean(child, &rrdcreate_config.async);
else if (strcasecmp("CollectStatistics", key) == 0)
status = cf_util_get_boolean(child, &config_collect_stats);
else if (strcasecmp("StepSize", key) == 0) {
int tmp = -1;
status = rc_config_get_int_positive(child, &tmp);
if (status == 0)
rrdcreate_config.stepsize = (unsigned long)tmp;
} else if (strcasecmp("HeartBeat", key) == 0)
status = rc_config_get_int_positive(child, &rrdcreate_config.heartbeat);
else if (strcasecmp("RRARows", key) == 0)
status = rc_config_get_int_positive(child, &rrdcreate_config.rrarows);
else if (strcasecmp("RRATimespan", key) == 0) {
int tmp = -1;
status = rc_config_get_int_positive(child, &tmp);
if (status == 0)
status = rc_config_add_timespan(tmp);
} else if (strcasecmp("XFF", key) == 0)
status = rc_config_get_xff(child, &rrdcreate_config.xff);
else {
WARNING("rrdcached plugin: Ignoring invalid option %s.", key);
continue;
}
if (status != 0)
WARNING("rrdcached plugin: Handling the \"%s\" option failed.", key);
}
if (daemon_address != NULL) {
plugin_register_write("rrdcached", rc_write, /* user_data = */ NULL);
plugin_register_flush("rrdcached", rc_flush, /* user_data = */ NULL);
}
return 0;
} /* int rc_config */
示例2: dpdk_events_link_status_config
static int dpdk_events_link_status_config(dpdk_events_ctx_t *ec,
oconfig_item_t *ci) {
ec->config.link_status.enabled = 1;
DEBUG(DPDK_EVENTS_PLUGIN ": Subscribed for Link Status Events.");
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("EnabledPortMask", child->key) == 0) {
if (cf_util_get_int(child,
(int *)&ec->config.link_status.enabled_port_mask))
return -1;
DEBUG(DPDK_EVENTS_PLUGIN ": LinkStatus:Enabled Port Mask 0x%X",
ec->config.link_status.enabled_port_mask);
} else if (strcasecmp("SendEventsOnUpdate", child->key) == 0) {
if (cf_util_get_boolean(child, &ec->config.link_status.send_updated))
return -1;
DEBUG(DPDK_EVENTS_PLUGIN ": LinkStatus:SendEventsOnUpdate %d",
ec->config.link_status.send_updated);
} else if (strcasecmp("SendNotification", child->key) == 0) {
if (cf_util_get_boolean(child, &ec->config.link_status.notify))
return -1;
DEBUG(DPDK_EVENTS_PLUGIN ": LinkStatus:SendNotification %d",
ec->config.link_status.notify);
} else if (strcasecmp("PortName", child->key) != 0) {
ERROR(DPDK_EVENTS_PLUGIN ": unrecognized configuration option %s.",
child->key);
return -1;
}
}
int port_num = 0;
/* parse port names after EnabledPortMask was parsed */
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("PortName", child->key) == 0) {
while (!(ec->config.link_status.enabled_port_mask & (1 << port_num)))
port_num++;
if (cf_util_get_string_buffer(
child, ec->config.link_status.port_name[port_num],
sizeof(ec->config.link_status.port_name[port_num]))) {
return -1;
}
DEBUG(DPDK_EVENTS_PLUGIN ": LinkStatus:Port %d Name: %s", port_num,
ec->config.link_status.port_name[port_num]);
port_num++;
}
}
return 0;
}
示例3: memory_config
static int memory_config(oconfig_item_t *ci) /* {{{ */
{
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("ValuesAbsolute", child->key) == 0)
cf_util_get_boolean(child, &values_absolute);
else if (strcasecmp("ValuesPercentage", child->key) == 0)
cf_util_get_boolean(child, &values_percentage);
else
ERROR("memory plugin: Invalid configuration option: "
"\"%s\".",
child->key);
}
return 0;
} /* }}} int memory_config */
示例4: statsd_config_node
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);
}
示例5: dpdk_events_keep_alive_config
static int dpdk_events_keep_alive_config(dpdk_events_ctx_t *ec,
oconfig_item_t *ci) {
ec->config.keep_alive.enabled = 1;
DEBUG(DPDK_EVENTS_PLUGIN ": Subscribed for Keep Alive Events.");
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("SendEventsOnUpdate", child->key) == 0) {
if (cf_util_get_boolean(child, &ec->config.keep_alive.send_updated))
return -1;
DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:SendEventsOnUpdate %d",
ec->config.keep_alive.send_updated);
} else if (strcasecmp("LCoreMask", child->key) == 0) {
char lcore_mask[DATA_MAX_NAME_LEN];
if (cf_util_get_string_buffer(child, lcore_mask, sizeof(lcore_mask)))
return -1;
ec->config.keep_alive.lcore_mask =
str_to_uint128(lcore_mask, strlen(lcore_mask));
DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:LCoreMask 0x%" PRIX64 "%" PRIX64 "",
ec->config.keep_alive.lcore_mask.high,
ec->config.keep_alive.lcore_mask.low);
} else if (strcasecmp("KeepAliveShmName", child->key) == 0) {
if (cf_util_get_string_buffer(child, ec->config.keep_alive.shm_name,
sizeof(ec->config.keep_alive.shm_name)))
return -1;
DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:KeepAliveShmName %s",
ec->config.keep_alive.shm_name);
} else if (strcasecmp("SendNotification", child->key) == 0) {
if (cf_util_get_boolean(child, &ec->config.keep_alive.notify))
return -1;
DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:SendNotification %d",
ec->config.keep_alive.notify);
} else {
ERROR(DPDK_EVENTS_PLUGIN ": unrecognized configuration option %s.",
child->key);
return -1;
}
}
return 0;
}
示例6: battery_config
static int battery_config(oconfig_item_t *ci) {
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("ValuesPercentage", child->key) == 0)
cf_util_get_boolean(child, &report_percent);
else if (strcasecmp("ReportDegraded", child->key) == 0)
cf_util_get_boolean(child, &report_degraded);
else if (strcasecmp("QueryStateFS", child->key) == 0)
cf_util_get_boolean(child, &query_statefs);
else
WARNING("battery plugin: Ignoring unknown "
"configuration option \"%s\".",
child->key);
}
return (0);
} /* }}} int battery_config */
示例7: swap_config
static int swap_config(oconfig_item_t *ci) /* {{{ */
{
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("ReportBytes", child->key) == 0)
#if KERNEL_LINUX
cf_util_get_boolean(child, &report_bytes);
#else
WARNING("swap plugin: The \"ReportBytes\" option "
"is only valid under Linux. "
"The option is going to be ignored.");
#endif
else if (strcasecmp("ReportByDevice", child->key) == 0)
#if SWAP_HAVE_REPORT_BY_DEVICE
cf_util_get_boolean(child, &report_by_device);
#else
WARNING("swap plugin: The \"ReportByDevice\" option "
"is not supported on this platform. "
"The option is going to be ignored.");
#endif /* SWAP_HAVE_REPORT_BY_DEVICE */
else if (strcasecmp("ValuesAbsolute", child->key) == 0)
示例8: apcups_config
static int apcups_config (oconfig_item_t *ci)
{
int i;
_Bool persistent_conn_set = 0;
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp (child->key, "Host") == 0)
cf_util_get_string (child, &conf_node);
else if (strcasecmp (child->key, "Port") == 0)
cf_util_get_service (child, &conf_service);
else if (strcasecmp (child->key, "ReportSeconds") == 0)
cf_util_get_boolean (child, &conf_report_seconds);
else if (strcasecmp (child->key, "PersistentConnection") == 0) {
cf_util_get_boolean (child, &conf_persistent_conn);
persistent_conn_set = 1;
}
else
ERROR ("apcups plugin: Unknown config option \"%s\".", child->key);
}
if (!persistent_conn_set) {
double interval = CDTIME_T_TO_DOUBLE(plugin_get_interval());
if (interval > APCUPS_SERVER_TIMEOUT) {
NOTICE ("apcups plugin: Plugin poll interval set to %.3f seconds. "
"Apcupsd NIS socket timeout is %.3f seconds, "
"PersistentConnection disabled by default.",
interval, APCUPS_SERVER_TIMEOUT);
conf_persistent_conn = 0;
}
}
return (0);
} /* int apcups_config */
示例9: statsd_config
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 */
示例10: ethstat_config
static int ethstat_config(oconfig_item_t *ci) /* {{{ */
{
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("Interface", child->key) == 0)
ethstat_add_interface(child);
else if (strcasecmp("Map", child->key) == 0)
ethstat_add_map(child);
else if (strcasecmp("MappedOnly", child->key) == 0)
(void)cf_util_get_boolean(child, &collect_mapped_only);
else
WARNING("ethstat plugin: The config option \"%s\" is unknown.",
child->key);
}
return 0;
} /* }}} */
示例11: calloc
/*
* Public API
*/
curl_stats_t *curl_stats_from_config (oconfig_item_t *ci)
{
curl_stats_t *s;
int i;
if (ci == NULL)
return NULL;
s = calloc (1, sizeof (*s));
if (s == NULL)
return NULL;
for (i = 0; i < ci->children_num; ++i)
{
oconfig_item_t *c = ci->children + i;
size_t field;
_Bool enabled = 0;
for (field = 0; field < STATIC_ARRAY_SIZE (field_specs); ++field) {
if (! strcasecmp (c->key, field_specs[field].config_key))
break;
if (! strcasecmp (c->key, field_specs[field].name))
break;
}
if (field >= STATIC_ARRAY_SIZE (field_specs))
{
ERROR ("curl stats: Unknown field name %s", c->key);
free (s);
return NULL;
}
if (cf_util_get_boolean (c, &enabled) != 0) {
free (s);
return NULL;
}
if (enabled)
enable_field (s, field_specs[field].offset);
}
return s;
} /* curl_stats_from_config */
示例12: kafka_config_topic
//.........这里部分代码省略.........
break;
}
if (strcasecmp(tmp_buf, "Random") != 0) {
tctx->has_key = 1;
tctx->key = crc32_buffer((u_char *)tmp_buf, strlen(tmp_buf));
}
sfree(tmp_buf);
} else if (strcasecmp ("Format", child->key) == 0) {
status = cf_util_get_string(child, &key);
if (status != 0)
goto errout;
assert(key != NULL);
if (strcasecmp(key, "Command") == 0) {
tctx->format = KAFKA_FORMAT_COMMAND;
} else if (strcasecmp(key, "Graphite") == 0) {
tctx->format = KAFKA_FORMAT_GRAPHITE;
} else if (strcasecmp(key, "Json") == 0) {
tctx->format = KAFKA_FORMAT_JSON;
} else {
WARNING ("write_kafka plugin: Invalid format string: %s",
key);
}
sfree(key);
} else if (strcasecmp ("StoreRates", child->key) == 0) {
status = cf_util_get_boolean (child, &tctx->store_rates);
(void) cf_util_get_flag (child, &tctx->graphite_flags,
GRAPHITE_STORE_RATES);
} else if (strcasecmp ("GraphiteSeparateInstances", child->key) == 0) {
status = cf_util_get_flag (child, &tctx->graphite_flags,
GRAPHITE_SEPARATE_INSTANCES);
} else if (strcasecmp ("GraphiteAlwaysAppendDS", child->key) == 0) {
status = cf_util_get_flag (child, &tctx->graphite_flags,
GRAPHITE_ALWAYS_APPEND_DS);
} else if (strcasecmp ("GraphitePrefix", child->key) == 0) {
status = cf_util_get_string (child, &tctx->prefix);
} else if (strcasecmp ("GraphitePostfix", child->key) == 0) {
status = cf_util_get_string (child, &tctx->postfix);
} else if (strcasecmp ("GraphiteEscapeChar", child->key) == 0) {
char *tmp_buff = NULL;
status = cf_util_get_string (child, &tmp_buff);
if (strlen (tmp_buff) > 1)
WARNING ("write_kafka plugin: The option \"GraphiteEscapeChar\" handles "
"only one character. Others will be ignored.");
tctx->escape_char = tmp_buff[0];
sfree (tmp_buff);
} else {
WARNING ("write_kafka plugin: Invalid directive: %s.", child->key);
}
if (status != 0)
break;
}
rd_kafka_topic_conf_set_partitioner_cb(tctx->conf, kafka_partition);
示例13: cx_config_add_url
static int cx_config_add_url (oconfig_item_t *ci) /* {{{ */
{
cx_t *db;
int status = 0;
int i;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl_xml plugin: The `URL' block "
"needs exactly one string argument.");
return (-1);
}
db = (cx_t *) malloc (sizeof (*db));
if (db == NULL)
{
ERROR ("curl_xml plugin: malloc failed.");
return (-1);
}
memset (db, 0, sizeof (*db));
db->timeout = -1;
if (strcasecmp ("URL", ci->key) == 0)
{
status = cf_util_get_string (ci, &db->url);
if (status != 0)
{
sfree (db);
return (status);
}
}
else
{
ERROR ("curl_xml plugin: cx_config: "
"Invalid key: %s", ci->key);
cx_free (db);
return (-1);
}
/* Fill the `cx_t' structure.. */
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("Instance", child->key) == 0)
status = cf_util_get_string (child, &db->instance);
else if (strcasecmp ("Host", child->key) == 0)
status = cf_util_get_string (child, &db->host);
else if (strcasecmp ("User", child->key) == 0)
status = cf_util_get_string (child, &db->user);
else if (strcasecmp ("Password", child->key) == 0)
status = cf_util_get_string (child, &db->pass);
else if (strcasecmp ("Digest", child->key) == 0)
status = cf_util_get_boolean (child, &db->digest);
else if (strcasecmp ("VerifyPeer", child->key) == 0)
status = cf_util_get_boolean (child, &db->verify_peer);
else if (strcasecmp ("VerifyHost", child->key) == 0)
status = cf_util_get_boolean (child, &db->verify_host);
else if (strcasecmp ("CACert", child->key) == 0)
status = cf_util_get_string (child, &db->cacert);
else if (strcasecmp ("xpath", child->key) == 0)
status = cx_config_add_xpath (db, child);
else if (strcasecmp ("Header", child->key) == 0)
status = cx_config_append_string ("Header", &db->headers, child);
else if (strcasecmp ("Post", child->key) == 0)
status = cf_util_get_string (child, &db->post_body);
else if (strcasecmp ("Namespace", child->key) == 0)
status = cx_config_add_namespace (db, child);
else if (strcasecmp ("Timeout", child->key) == 0)
status = cf_util_get_int (child, &db->timeout);
else
{
WARNING ("curl_xml plugin: Option `%s' not allowed here.", child->key);
status = -1;
}
if (status != 0)
break;
}
if (status == 0)
{
if (db->list == NULL)
{
WARNING ("curl_xml plugin: No (valid) `Key' block "
"within `URL' block `%s'.", db->url);
status = -1;
}
if (status == 0)
status = cx_init_curl (db);
}
/* If all went well, register this database for reading */
if (status == 0)
{
user_data_t ud;
char *cb_name;
//.........这里部分代码省略.........
示例14: mr_create
static int mr_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
{
mr_match_t *m;
int status;
int i;
m = (mr_match_t *) malloc (sizeof (*m));
if (m == NULL)
{
log_err ("mr_create: malloc failed.");
return (-ENOMEM);
}
memset (m, 0, sizeof (*m));
m->invert = 0;
status = 0;
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if ((strcasecmp ("Host", child->key) == 0)
|| (strcasecmp ("Hostname", child->key) == 0))
status = mr_config_add_regex (&m->host, child);
else if (strcasecmp ("Plugin", child->key) == 0)
status = mr_config_add_regex (&m->plugin, child);
else if (strcasecmp ("PluginInstance", child->key) == 0)
status = mr_config_add_regex (&m->plugin_instance, child);
else if (strcasecmp ("Type", child->key) == 0)
status = mr_config_add_regex (&m->type, child);
else if (strcasecmp ("TypeInstance", child->key) == 0)
status = mr_config_add_regex (&m->type_instance, child);
else if (strcasecmp ("Invert", child->key) == 0)
status = cf_util_get_boolean(child, &m->invert);
else
{
log_err ("The `%s' configuration option is not understood and "
"will be ignored.", child->key);
status = 0;
}
if (status != 0)
break;
}
/* Additional sanity-checking */
while (status == 0)
{
if ((m->host == NULL)
&& (m->plugin == NULL)
&& (m->plugin_instance == NULL)
&& (m->type == NULL)
&& (m->type_instance == NULL))
{
log_err ("No (valid) regular expressions have been configured. "
"This match will be ignored.");
status = -1;
}
break;
}
if (status != 0)
{
mr_free_match (m);
return (status);
}
*user_data = m;
return (0);
} /* }}} int mr_create */
示例15: riemann_config_node
static int
riemann_config_node(oconfig_item_t *ci)
{
struct riemann_host *host = NULL;
int status = 0;
int i;
oconfig_item_t *child;
char callback_name[DATA_MAX_NAME_LEN];
user_data_t ud;
if ((host = calloc(1, sizeof (*host))) == NULL) {
ERROR ("write_riemann plugin: calloc failed.");
return ENOMEM;
}
pthread_mutex_init (&host->lock, NULL);
host->reference_count = 1;
host->node = NULL;
host->service = NULL;
host->store_rates = 1;
host->always_append_ds = 0;
host->use_tcp = 0;
status = cf_util_get_string (ci, &host->name);
if (status != 0) {
WARNING("write_riemann plugin: Required host name is missing.");
riemann_free (host);
return -1;
}
for (i = 0; i < ci->children_num; i++) {
/*
* The code here could be simplified but makes room
* for easy adding of new options later on.
*/
child = &ci->children[i];
status = 0;
if (strcasecmp ("Host", child->key) == 0) {
status = cf_util_get_string (child, &host->node);
if (status != 0)
break;
} else if (strcasecmp ("Port", child->key) == 0) {
status = cf_util_get_service (child, &host->service);
if (status != 0) {
ERROR ("write_riemann plugin: Invalid argument "
"configured for the \"Port\" "
"option.");
break;
}
} else if (strcasecmp ("Protocol", child->key) == 0) {
char tmp[16];
status = cf_util_get_string_buffer (child,
tmp, sizeof (tmp));
if (status != 0)
{
ERROR ("write_riemann plugin: cf_util_get_"
"string_buffer failed with "
"status %i.", status);
break;
}
if (strcasecmp ("UDP", tmp) == 0)
host->use_tcp = 0;
else if (strcasecmp ("TCP", tmp) == 0)
host->use_tcp = 1;
else
WARNING ("write_riemann plugin: The value "
"\"%s\" is not valid for the "
"\"Protocol\" option. Use "
"either \"UDP\" or \"TCP\".",
tmp);
} else if (strcasecmp ("StoreRates", child->key) == 0) {
status = cf_util_get_boolean (child, &host->store_rates);
if (status != 0)
break;
} else if (strcasecmp ("AlwaysAppendDS", child->key) == 0) {
status = cf_util_get_boolean (child,
&host->always_append_ds);
if (status != 0)
break;
} else {
WARNING("write_riemann plugin: ignoring unknown config "
"option: \"%s\"", child->key);
}
}
if (status != 0) {
riemann_free (host);
return status;
}
ssnprintf (callback_name, sizeof (callback_name), "write_riemann/%s",
host->name);
ud.data = host;
ud.free_func = riemann_free;
pthread_mutex_lock (&host->lock);
status = plugin_register_write (callback_name, riemann_write, &ud);
if (status != 0)
WARNING ("write_riemann plugin: plugin_register_write (\"%s\") "
//.........这里部分代码省略.........