B<MeasureResponseCode> options are set to B<true>, B<Match> blocks are
optional.
+=item B<Interval> I<Interval>
+
+Sets the interval (in seconds) in which the values will be collected from this
+URL. By default the global B<Interval> setting will be used.
+
=item B<Timeout> I<Milliseconds>
The B<Timeout> option sets the overall timeout for HTTP requests to B<URL>, in
May be overridden by B<PluginInstanceFrom> option inside B<XPath> blocks.
Defaults to an empty string (no plugin instance).
+=item B<Interval> I<Interval>
+
+Sets the interval (in seconds) in which the values will be collected from this
+URL. By default the global B<Interval> setting will be used.
+
=item B<Namespace> I<Prefix> I<URL>
If an XPath expression references namespaces, they must be specified
size_t buffer_fill;
web_match_t *matches;
-
- web_page_t *next;
}; /* }}} */
/*
- * Global variables;
- */
-static web_page_t *pages_g;
-
-/*
* Private functions
*/
+static int cc_read_page(user_data_t *ud);
+
static size_t cc_curl_callback(void *buf, /* {{{ */
size_t size, size_t nmemb, void *user_data) {
web_page_t *wp;
sfree(wm);
} /* }}} void cc_web_match_free */
-static void cc_web_page_free(web_page_t *wp) /* {{{ */
+static void cc_web_page_free(void *arg) /* {{{ */
{
+ web_page_t *wp = (web_page_t *)arg;
if (wp == NULL)
return;
sfree(wp->buffer);
cc_web_match_free(wp->matches);
- cc_web_page_free(wp->next);
sfree(wp);
} /* }}} void cc_web_page_free */
static int cc_config_add_page(oconfig_item_t *ci) /* {{{ */
{
+ cdtime_t interval = 0;
web_page_t *page;
int status;
status = cc_config_append_string("Header", &page->headers, child);
else if (strcasecmp("Post", child->key) == 0)
status = cf_util_get_string(child, &page->post_body);
+ else if (strcasecmp("Interval", child->key) == 0)
+ status = cf_util_get_cdtime(child, &interval);
else if (strcasecmp("Timeout", child->key) == 0)
status = cf_util_get_int(child, &page->timeout);
else if (strcasecmp("Statistics", child->key) == 0) {
return status;
}
- /* Add the new page to the linked list */
- if (pages_g == NULL)
- pages_g = page;
- else {
- web_page_t *prev;
+ /* If all went well, register this page for reading */
+ char *cb_name = ssnprintf_alloc("curl-%s-%s", page->instance, page->url);
- prev = pages_g;
- while (prev->next != NULL)
- prev = prev->next;
- prev->next = page;
- }
+ plugin_register_complex_read(/* group = */ NULL, cb_name, cc_read_page,
+ interval,
+ &(user_data_t){
+ .data = page, .free_func = cc_web_page_free,
+ });
+ sfree(cb_name);
return 0;
} /* }}} int cc_config_add_page */
static int cc_init(void) /* {{{ */
{
- if (pages_g == NULL) {
- INFO("curl plugin: No pages have been defined.");
- return -1;
- }
curl_global_init(CURL_GLOBAL_SSL);
return 0;
} /* }}} int cc_init */
plugin_dispatch_values(&vl);
} /* }}} void cc_submit_response_time */
-static int cc_read_page(web_page_t *wp) /* {{{ */
+static int cc_read_page(user_data_t *ud) /* {{{ */
{
+
+ if ((ud == NULL) || (ud->data == NULL)) {
+ ERROR("curl plugin: cc_read_page: Invalid user data.");
+ return -1;
+ }
+
+ web_page_t *wp = (web_page_t *)ud->data;
+
int status;
cdtime_t start = 0;
return 0;
} /* }}} int cc_read_page */
-static int cc_read(void) /* {{{ */
-{
- for (web_page_t *wp = pages_g; wp != NULL; wp = wp->next)
- cc_read_page(wp);
-
- return 0;
-} /* }}} int cc_read */
-
-static int cc_shutdown(void) /* {{{ */
-{
- cc_web_page_free(pages_g);
- pages_g = NULL;
-
- return 0;
-} /* }}} int cc_shutdown */
-
void module_register(void) {
plugin_register_complex_config("curl", cc_config);
plugin_register_init("curl", cc_init);
- plugin_register_read("curl", cc_read);
- plugin_register_shutdown("curl", cc_shutdown);
} /* void module_register */
char *cacert;
struct curl_slist *headers;
char *post_body;
- cdtime_t interval;
int timeout;
curl_stats_t *stats;
#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (db->timeout >= 0)
curl_easy_setopt(db->curl, CURLOPT_TIMEOUT_MS, (long)db->timeout);
- else if (db->interval > 0)
- curl_easy_setopt(db->curl, CURLOPT_TIMEOUT_MS,
- (long)CDTIME_T_TO_MS(db->interval));
else
curl_easy_setopt(db->curl, CURLOPT_TIMEOUT_MS,
(long)CDTIME_T_TO_MS(plugin_get_interval()));
{
cj_t *db;
int status = 0;
+ cdtime_t interval = 0;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
WARNING("curl_json plugin: The `URL' block "
else if (strcasecmp("Key", child->key) == 0)
status = cj_config_add_key(db, child);
else if (strcasecmp("Interval", child->key) == 0)
- status = cf_util_get_cdtime(child, &db->interval);
+ status = cf_util_get_cdtime(child, &interval);
else if (strcasecmp("Timeout", child->key) == 0)
status = cf_util_get_int(child, &db->timeout);
else if (strcasecmp("Statistics", child->key) == 0) {
cb_name = ssnprintf_alloc("curl_json-%s-%s", db->instance,
db->url ? db->url : db->sock);
- plugin_register_complex_read(/* group = */ NULL, cb_name, cj_read,
- /* interval = */ db->interval,
+ plugin_register_complex_read(/* group = */ NULL, cb_name, cj_read, interval,
&(user_data_t){
.data = db, .free_func = cj_free,
});
sstrncpy(vl.plugin_instance, db->instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, key->type, sizeof(vl.type));
- if (db->interval > 0)
- vl.interval = db->interval;
-
plugin_dispatch_values(&vl);
} /* }}} int cj_submit_impl */
return status;
}
+ cdtime_t interval = 0;
+
/* Fill the `cx_t' structure.. */
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
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("Interval", child->key) == 0)
+ status = cf_util_get_cdtime(child, &interval);
else if (strcasecmp("Timeout", child->key) == 0)
status = cf_util_get_int(child, &db->timeout);
else if (strcasecmp("Statistics", child->key) == 0) {
char *cb_name = ssnprintf_alloc("curl_xml-%s-%s", db->instance, db->url);
plugin_register_complex_read(/* group = */ "curl_xml", cb_name, cx_read,
- /* interval = */ 0,
+ /* interval = */ interval,
&(user_data_t){
.data = db, .free_func = cx_free,
});
/* default to the global interval set before loading this plugin */
ctx.interval = cf_get_default_interval();
+ ctx.name = strdup(name);
old_ctx = plugin_set_ctx(ctx);
status = plugin_load(name, /* flags = */ false);
old_cf = le->value;
le->value = cf;
- WARNING("plugin: register_callback: "
- "a callback named `%s' already exists - "
- "overwriting the old entry!",
- name);
+ P_WARNING("register_callback: "
+ "a callback named `%s' already exists - "
+ "overwriting the old entry!",
+ name);
destroy_callback(old_cf);
sfree(key);
n = llist_size(*list);
if (n == 0) {
- INFO("%s [none]", comment);
+ INFO("%s: [none]", comment);
return;
}
vl->time = cdtime();
/* Fill in the interval from the thread context, if it is zero. */
- if (vl->interval == 0) {
- plugin_ctx_t ctx = plugin_get_ctx();
-
- if (ctx.interval != 0)
- vl->interval = ctx.interval;
- else {
- char name[6 * DATA_MAX_NAME_LEN];
- FORMAT_VL(name, sizeof(name), vl);
- ERROR("plugin_value_list_clone: Unable to determine "
- "interval from context for "
- "value list \"%s\". "
- "This indicates a broken plugin. "
- "Please report this problem to the "
- "collectd mailing list or at "
- "<http://collectd.org/bugs/>.",
- name);
- vl->interval = cf_get_default_interval();
- }
- }
+ if (vl->interval == 0)
+ vl->interval = plugin_get_interval();
return vl;
} /* }}} value_list_t *plugin_value_list_clone */
le = llist_search(read_list, rf->rf_name);
if (le != NULL) {
pthread_mutex_unlock(&read_lock);
- WARNING("The read function \"%s\" is already registered. "
- "Check for duplicates in your configuration!",
- rf->rf_name);
+ P_WARNING("The read function \"%s\" is already registered. "
+ "Check for duplicates in your configuration!",
+ rf->rf_name);
return EINVAL;
}
rf->rf_name = strdup(name);
rf->rf_type = RF_SIMPLE;
rf->rf_interval = plugin_get_interval();
+ rf->rf_ctx.interval = rf->rf_interval;
status = plugin_insert_read(rf);
if (status != 0) {
}
rf->rf_ctx = plugin_get_ctx();
+ rf->rf_ctx.interval = rf->rf_interval;
status = plugin_insert_read(rf);
if (status != 0) {
data_set_t *ds;
if (data_sets == NULL) {
- ERROR("plugin_get_ds: No data sets are defined yet.");
+ P_ERROR("plugin_get_ds: No data sets are defined yet.");
return NULL;
}
if (interval > 0)
return interval;
+ P_ERROR("plugin_get_interval: Unable to determine Interval from context.");
+
return cf_get_default_interval();
} /* cdtime_t plugin_get_interval */
char *select_db;
char *plugin_name;
- cdtime_t interval;
-
char *driver;
char *host;
cdbi_driver_option_t *driver_options;
static int cdbi_config_add_database(oconfig_item_t *ci) /* {{{ */
{
+ cdtime_t interval = 0;
cdbi_database_t *db;
int status;
else if (strcasecmp("Host", child->key) == 0)
status = cf_util_get_string(child, &db->host);
else if (strcasecmp("Interval", child->key) == 0)
- status = cf_util_get_cdtime(child, &db->interval);
+ status = cf_util_get_cdtime(child, &interval);
else if (strcasecmp("Plugin", child->key) == 0)
status = cf_util_get_string(child, &db->plugin_name);
else {
/* group = */ NULL,
/* name = */ name ? name : db->name,
/* callback = */ cdbi_read_database,
- /* interval = */ (db->interval > 0) ? db->interval : 0,
+ /* interval = */ interval,
&(user_data_t){
.data = db,
});
status = udb_query_prepare_result(
q, prep_area, (db->host ? db->host : hostname_g),
/* plugin = */ (db->plugin_name != NULL) ? db->plugin_name : "dbi",
- db->name, column_names, column_num,
- /* interval = */ (db->interval > 0) ? db->interval : 0);
+ db->name, column_names, column_num);
if (status != 0) {
ERROR("dbi plugin: udb_query_prepare_result failed with status %i.",
static int dpdk_helper_link_status_get(dpdk_helper_ctx_t *phc) {
dpdk_events_ctx_t *ec = DPDK_EVENTS_CTX_GET(phc);
- /* get Link Status values from DPDK */
+/* get Link Status values from DPDK */
+#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
uint8_t nb_ports = rte_eth_dev_count();
+#else
+ uint8_t nb_ports = rte_eth_dev_count_avail();
+#endif
if (nb_ports == 0) {
DPDK_CHILD_LOG("dpdkevent-helper: No DPDK ports available. "
"Check bound devices to DPDK driver.\n");
int port; /* for Modbus/TCP */
int baudrate; /* for Modbus/RTU */
mb_conntype_t conntype;
- cdtime_t interval;
mb_slave_t *slaves;
size_t slaves_num;
if ((host == NULL) || (slave == NULL) || (data == NULL))
return EINVAL;
- if (host->interval == 0)
- host->interval = plugin_get_interval();
-
if (slave->instance[0] == 0)
snprintf(slave->instance, sizeof(slave->instance), "slave_%i", slave->id);
vl.values = &value;
vl.values_len = 1;
- vl.interval = host->interval;
sstrncpy(vl.host, host->host, sizeof(vl.host));
sstrncpy(vl.plugin, "modbus", sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, slave->instance, sizeof(vl.plugin_instance));
static int mb_config_add_host(oconfig_item_t *ci) /* {{{ */
{
+ cdtime_t interval = 0;
mb_host_t *host;
int status;
} else if (strcasecmp("Baudrate", child->key) == 0)
status = cf_util_get_int(child, &host->baudrate);
else if (strcasecmp("Interval", child->key) == 0)
- status = cf_util_get_cdtime(child, &host->interval);
+ status = cf_util_get_cdtime(child, &interval);
else if (strcasecmp("Slave", child->key) == 0)
/* Don't set status: Gracefully continue if a slave fails. */
mb_config_add_slave(host, child);
plugin_register_complex_read(/* group = */ NULL, name,
/* callback = */ mb_read,
- /* interval = */ host->interval,
+ /* interval = */ interval,
&(user_data_t){
.data = host, .free_func = host_free,
});
status = udb_query_prepare_result(
q, prep_area, (db->host != NULL) ? db->host : hostname_g,
/* plugin = */ (db->plugin_name != NULL) ? db->plugin_name : "oracle",
- db->name, column_names, column_num,
- /* interval = */ 0);
+ db->name, column_names, column_num);
if (status != 0) {
ERROR("oracle plugin: o_read_database_query (%s, %s): "
"udb_query_prepare_result failed.",
/* make sure we don't access the database object in parallel */
pthread_mutex_t db_lock;
- cdtime_t interval;
-
/* writer "caching" settings */
cdtime_t commit_interval;
cdtime_t next_commit;
pthread_mutex_init(&db->db_lock, /* attrs = */ NULL);
- db->interval = 0;
-
db->commit_interval = 0;
db->next_commit = 0;
db->expire_delay = 0;
break;
case C_PSQL_PARAM_INTERVAL:
snprintf(interval, sizeof(interval), "%.3f",
- (db->interval > 0) ? CDTIME_T_TO_DOUBLE(db->interval)
- : plugin_get_interval());
+ CDTIME_T_TO_DOUBLE(plugin_get_interval()));
params[i] = interval;
break;
case C_PSQL_PARAM_INSTANCE:
status = udb_query_prepare_result(
q, prep_area, host,
(db->plugin_name != NULL) ? db->plugin_name : "postgresql", db->instance,
- column_names, (size_t)column_num, db->interval);
+ column_names, (size_t)column_num);
if (0 != status) {
log_err("udb_query_prepare_result failed with status %i.", status);
static int c_psql_config_database(oconfig_item_t *ci) {
c_psql_database_t *db;
+ cdtime_t interval = 0;
char cb_name[DATA_MAX_NAME_LEN];
static bool have_flush;
config_add_writer(c, writers, writers_num, &db->writers,
&db->writers_num);
else if (0 == strcasecmp(c->key, "Interval"))
- cf_util_get_cdtime(c, &db->interval);
+ cf_util_get_cdtime(c, &interval);
else if (strcasecmp("CommitInterval", c->key) == 0)
cf_util_get_cdtime(c, &db->commit_interval);
else if (strcasecmp("ExpireDelay", c->key) == 0)
if (db->queries_num > 0) {
++db->ref_cnt;
- plugin_register_complex_read("postgresql", cb_name, c_psql_read,
- /* interval = */ db->interval, &ud);
+ plugin_register_complex_read("postgresql", cb_name, c_psql_read, interval,
+ &ud);
}
if (db->writers_num > 0) {
++db->ref_cnt;
"total_connections_received", DS_TYPE_DERIVE);
redis_handle_info(rn->name, rr->str, "total_operations", NULL,
"total_commands_processed", DS_TYPE_DERIVE);
- redis_handle_info(rn->name, rr->str, "operations_per_second", NULL,
- "instantaneous_ops_per_sec", DS_TYPE_GAUGE);
redis_handle_info(rn->name, rr->str, "expired_keys", NULL, "expired_keys",
DS_TYPE_DERIVE);
redis_handle_info(rn->name, rr->str, "evicted_keys", NULL, "evicted_keys",
void *sess_handle;
c_complain_t complaint;
- cdtime_t interval;
data_definition_t **data_list;
int data_list_len;
};
int status = 0;
/* Registration stuff. */
+ cdtime_t interval = 0;
char cb_name[DATA_MAX_NAME_LEN];
hd = calloc(1, sizeof(*hd));
}
hd->sess_handle = NULL;
- hd->interval = 0;
/* These mean that we have not set a timeout or retry value */
hd->timeout = 0;
else if (strcasecmp("Collect", option->key) == 0)
status = csnmp_config_add_host_collect(hd, option);
else if (strcasecmp("Interval", option->key) == 0)
- status = cf_util_get_cdtime(option, &hd->interval);
+ status = cf_util_get_cdtime(option, &interval);
else if (strcasecmp("Username", option->key) == 0)
status = cf_util_get_string(option, &hd->username);
else if (strcasecmp("AuthProtocol", option->key) == 0)
snprintf(cb_name, sizeof(cb_name), "snmp-%s", hd->name);
status = plugin_register_complex_read(
- /* group = */ NULL, cb_name, csnmp_read_host, hd->interval,
+ /* group = */ NULL, cb_name, csnmp_read_host, interval,
&(user_data_t){
.data = hd, .free_func = csnmp_host_definition_destroy,
});
sstrncpy(vl.plugin, data->plugin_name, sizeof(vl.plugin));
sstrncpy(vl.type, data->type, sizeof(vl.type));
- vl.interval = host->interval;
-
have_more = 1;
while (have_more) {
bool suffix_skipped = 0;
sstrncpy(vl.plugin_instance, data->plugin_instance.value,
sizeof(vl.plugin_instance));
- vl.interval = host->interval;
-
req = snmp_pdu_create(SNMP_MSG_GET);
if (req == NULL) {
ERROR("snmp plugin: snmp_pdu_create failed.");
host = ud->data;
- if (host->interval == 0)
- host->interval = plugin_get_interval();
-
if (host->sess_handle == NULL)
csnmp_host_open_session(host);
int flags;
char *type;
char *type_instance;
- cdtime_t interval;
latency_config_t latency;
};
typedef struct ctail_config_match_s ctail_config_match_t;
-static cu_tail_match_t **tail_match_list;
-static size_t tail_match_list_num;
-static cdtime_t tail_match_list_intervals[255];
+static size_t tail_file_num;
+
+static int ctail_read(user_data_t *ud);
+
+static void ctail_match_free(void *arg) {
+ tail_match_destroy((cu_tail_match_t *)arg);
+} /* void ctail_match_free */
static int ctail_config_add_match_dstype(ctail_config_match_t *cm,
oconfig_item_t *ci) {
static int ctail_config_add_match(cu_tail_match_t *tm, const char *plugin_name,
const char *plugin_instance,
- oconfig_item_t *ci, cdtime_t interval) {
+ oconfig_item_t *ci) {
ctail_config_match_t cm = {0};
int status;
status = tail_match_add_match_simple(
tm, cm.regex, cm.excluderegex, cm.flags,
(plugin_name != NULL) ? plugin_name : "tail", plugin_instance, cm.type,
- cm.type_instance, cm.latency, interval);
+ cm.type_instance, cm.latency);
if (status != 0)
ERROR("tail plugin: tail_match_add_match_simple failed.");
else if (strcasecmp("Interval", option->key) == 0)
cf_util_get_cdtime(option, &interval);
else if (strcasecmp("Match", option->key) == 0) {
- status = ctail_config_add_match(tm, plugin_name, plugin_instance, option,
- interval);
+ status = ctail_config_add_match(tm, plugin_name, plugin_instance, option);
if (status == 0)
num_matches++;
/* Be mild with failed matches.. */
ci->values[0].value.string);
tail_match_destroy(tm);
return -1;
- } else {
- cu_tail_match_t **temp;
-
- temp = realloc(tail_match_list,
- sizeof(cu_tail_match_t *) * (tail_match_list_num + 1));
- if (temp == NULL) {
- ERROR("tail plugin: realloc failed.");
- tail_match_destroy(tm);
- return -1;
- }
-
- tail_match_list = temp;
- tail_match_list[tail_match_list_num] = tm;
- tail_match_list_intervals[tail_match_list_num] = interval;
- tail_match_list_num++;
}
+ char str[255];
+ snprintf(str, sizeof(str), "tail-%zu", tail_file_num++);
+
+ plugin_register_complex_read(
+ NULL, str, ctail_read, interval,
+ &(user_data_t){.data = tm, .free_func = ctail_match_free});
+
return 0;
} /* int ctail_config_add_file */
return 0;
} /* int ctail_read */
-static int ctail_init(void) {
- char str[255];
-
- if (tail_match_list_num == 0) {
- WARNING("tail plugin: File list is empty. Returning an error.");
- return -1;
- }
-
- for (size_t i = 0; i < tail_match_list_num; i++) {
- snprintf(str, sizeof(str), "tail-%zu", i);
-
- plugin_register_complex_read(NULL, str, ctail_read,
- tail_match_list_intervals[i],
- &(user_data_t){
- .data = tail_match_list[i],
- });
- }
-
- return 0;
-} /* int ctail_init */
-
-static int ctail_shutdown(void) {
- for (size_t i = 0; i < tail_match_list_num; i++) {
- tail_match_destroy(tail_match_list[i]);
- tail_match_list[i] = NULL;
- }
- sfree(tail_match_list);
- tail_match_list_num = 0;
-
- return 0;
-} /* int ctail_shutdown */
-
void module_register(void) {
plugin_register_complex_config("tail", ctail_config);
- plugin_register_init("tail", ctail_init);
- plugin_register_shutdown("tail", ctail_shutdown);
} /* void module_register */
cu_tail_t *tail;
metric_definition_t **metric_list;
size_t metric_list_len;
- cdtime_t interval;
ssize_t time_from;
struct instance_definition_s *next;
};
sstrncpy(vl.type_instance, md->instance, sizeof(vl.type_instance));
vl.time = t;
- vl.interval = id->interval;
return plugin_dispatch_values(&vl);
}
int status = 0;
/* Registration variables */
+ cdtime_t interval = 0;
char cb_name[DATA_MAX_NAME_LEN];
id = calloc(1, sizeof(*id));
return status;
}
- /* Use default interval. */
- id->interval = plugin_get_interval();
-
for (int i = 0; i < ci->children_num; ++i) {
oconfig_item_t *option = ci->children + i;
status = 0;
else if (strcasecmp("Collect", option->key) == 0)
status = tcsv_config_add_instance_collect(id, option);
else if (strcasecmp("Interval", option->key) == 0)
- cf_util_get_cdtime(option, &id->interval);
+ cf_util_get_cdtime(option, &interval);
else if (strcasecmp("TimeFrom", option->key) == 0)
status = tcsv_config_get_index(option, &id->time_from);
else if (strcasecmp("Plugin", option->key) == 0)
snprintf(cb_name, sizeof(cb_name), "tail_csv/%s", id->path);
status = plugin_register_complex_read(
- NULL, cb_name, tcsv_read, id->interval,
+ NULL, cb_name, tcsv_read, interval,
&(user_data_t){
.data = id, .free_func = tcsv_instance_definition_destroy,
});
char *plugin;
char *db_name;
- cdtime_t interval;
-
udb_result_preparation_area_t *result_prep_areas;
}; /* }}} */
}
}
- if (q_area->interval > 0)
- vl.interval = q_area->interval;
-
sstrncpy(vl.host, q_area->host, sizeof(vl.host));
sstrncpy(vl.plugin, q_area->plugin, sizeof(vl.plugin));
sstrncpy(vl.type, r->type, sizeof(vl.type));
sfree(prep_area->plugin);
sfree(prep_area->db_name);
- prep_area->interval = 0;
-
for (r = q->results, r_area = prep_area->result_prep_areas; r != NULL;
r = r->next, r_area = r_area->next) {
/* this may happen during error conditions of the caller */
udb_query_preparation_area_t *prep_area,
const char *host, const char *plugin,
const char *db_name, char **column_names,
- size_t column_num, cdtime_t interval) {
+ size_t column_num) {
udb_result_preparation_area_t *r_area;
udb_result_t *r;
int status;
assert(prep_area->host == NULL);
assert(prep_area->plugin == NULL);
assert(prep_area->db_name == NULL);
- assert(prep_area->interval == 0);
#endif
prep_area->column_num = column_num;
prep_area->plugin = strdup(plugin);
prep_area->db_name = strdup(db_name);
- prep_area->interval = interval;
-
if ((prep_area->host == NULL) || (prep_area->plugin == NULL) ||
(prep_area->db_name == NULL)) {
P_ERROR("Query `%s': Prepare failed: Out of memory.", q->name);
udb_query_preparation_area_t *prep_area,
const char *host, const char *plugin,
const char *db_name, char **column_names,
- size_t column_num, cdtime_t interval);
+ size_t column_num);
int udb_query_handle_result(udb_query_t const *q,
udb_query_preparation_area_t *prep_area,
char **column_values);
}
uint8_t dpdk_helper_eth_dev_count(void) {
+#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0)
uint8_t ports = rte_eth_dev_count();
+#else
+ uint8_t ports = rte_eth_dev_count_avail();
+#endif
if (ports == 0) {
ERROR(
"%s:%d: No DPDK ports available. Check bound devices to DPDK driver.\n",
char plugin_instance[DATA_MAX_NAME_LEN];
char type[DATA_MAX_NAME_LEN];
char type_instance[DATA_MAX_NAME_LEN];
- cdtime_t interval;
latency_config_t latency_config;
};
typedef struct cu_tail_match_simple_s cu_tail_match_simple_t;
typedef struct cu_tail_match_match_s cu_tail_match_match_t;
struct cu_tail_match_s {
- int flags;
cu_tail_t *tail;
-
- cdtime_t interval;
cu_tail_match_match_t *matches;
size_t matches_num;
};
sstrncpy(vl.type, data->type, sizeof(vl.type));
sstrncpy(vl.type_instance, data->type_instance, sizeof(vl.type_instance));
- vl.interval = data->interval;
plugin_dispatch_values(&vl);
match_value_reset(match_value);
sstrncpy(vl.plugin, data->plugin, sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, data->plugin_instance,
sizeof(vl.plugin_instance));
- vl.interval = data->interval;
vl.time = cdtime();
/* Submit percentiles */
obj->matches = temp;
obj->matches_num++;
- DEBUG("tail_match_add_match interval %lf",
- CDTIME_T_TO_DOUBLE(((cu_tail_match_simple_t *)user_data)->interval));
temp = obj->matches + (obj->matches_num - 1);
temp->match = match;
const char *excluderegex, int ds_type,
const char *plugin, const char *plugin_instance,
const char *type, const char *type_instance,
- const latency_config_t latency_cfg,
- const cdtime_t interval) {
+ const latency_config_t latency_cfg) {
cu_match_t *match;
cu_tail_match_simple_t *user_data;
int status;
sstrncpy(user_data->type_instance, type_instance,
sizeof(user_data->type_instance));
- user_data->interval = interval;
-
if ((ds_type & UTILS_MATCH_DS_TYPE_GAUGE) &&
(ds_type & UTILS_MATCH_CF_GAUGE_DIST)) {
status = latency_config_copy(&user_data->latency_config, latency_cfg);
* When `tail_match_destroy' is called the `user_data' pointer is freed using
* the `free_user_data' callback - if it is not NULL.
* When using this interface the `tail_match' module doesn't dispatch any
- * values
- * itself - all that has to happen in either the match-callbacks or the
- * submit_match callback.
+ * values itself - all that has to happen in either the match-callbacks or
+ * the submit_match callback.
*
* RETURN VALUE
* Zero upon success, non-zero otherwise.
* tail_match_add_match_simple
*
* DESCRIPTION
- * A simplified version of `tail_match_add_match'. The regular expressen
- * `regex'
- * must match a number, which is then dispatched according to `ds_type'. See
- * the `match_create_simple' function in utils_match.h for a description how
- * this flag effects calculation of a new value.
+ * A simplified version of `tail_match_add_match'. The regular expression
+ * `regex' must match a number, which is then dispatched according to
+ * `ds_type'.
+ * See the `match_create_simple' function in utils_match.h for a description
+ * how this flag effects calculation of a new value.
* The values gathered are dispatched by the tail_match module in this case.
- * The
- * passed `plugin', `plugin_instance', `type', and `type_instance' are
+ * The passed `plugin', `plugin_instance', `type', and `type_instance' are
* directly used when submitting these values.
* With excluderegex it is possible to exlude lines from the match.
* The `latency_cfg' specifies configuration for submitting latency.
const char *excluderegex, int ds_type,
const char *plugin, const char *plugin_instance,
const char *type, const char *type_instance,
- const latency_config_t latency_cfg,
- const cdtime_t interval);
+ const latency_config_t latency_cfg);
/*
* NAME
* added `utils_match' objects.
* After all lines have been read and processed, the submit_match callback is
* called or, in case of tail_match_add_match_simple, the data is dispatched
- * to
- * the daemon directly.
+ * to the daemon directly.
*
* RETURN VALUE
* Zero on success, nonzero on failure.