summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aab7074)
raw | patch | inline | side by side (parent: aab7074)
author | Michal Bebjak <mbebjak@qualityunit.com> | |
Mon, 17 Aug 2015 11:07:23 +0000 (13:07 +0200) | ||
committer | Michal Bebjak <mbebjak@qualityunit.com> | |
Mon, 17 Aug 2015 11:07:23 +0000 (13:07 +0200) |
src/dbi.c | patch | blob | history |
diff --git a/src/dbi.c b/src/dbi.c
index c851ba2b121dc272874e513a18eb26ea888178e7..0a3d86070b55e50273bed3408905484aff47b701 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
char *name;
char *select_db;
+ cdtime_t interval;
+
char *driver;
char *host;
cdbi_driver_option_t *driver_options;
*
* <Database "plugin_instance1">
* Driver "mysql"
+ * Interval 120
* DriverOption "hostname" "localhost"
* ...
* Query "plugin_instance0"
&db->queries, &db->queries_num);
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);
else
{
WARNING ("dbi plugin: Option `%s' not allowed here.", child->key);
{
user_data_t ud;
char *name = NULL;
+ struct timespec interval = { 0, 0 };
+ CDTIME_T_TO_TIMESPEC (db->interval, &interval);
databases = temp;
databases[databases_num] = db;
plugin_register_complex_read (/* group = */ NULL,
/* name = */ name ? name : db->name,
/* callback = */ cdbi_read_database,
- /* interval = */ 0,
+ /* interval = */ (db->interval > 0) ? &interval : NULL,
/* user_data = */ &ud);
free (name);
}
udb_query_prepare_result (q, prep_area, (db->host ? db->host : hostname_g),
/* plugin = */ "dbi", db->name,
- column_names, column_num, /* interval = */ 0);
+ column_names, column_num, /* interval = */ (db->interval > 0) ? db->interval : 0);
/* 0 = error; 1 = success; */
status = dbi_result_first_row (res); /* {{{ */