summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ed69e7)
raw | patch | inline | side by side (parent: 0ed69e7)
author | Gergely Nagy <algernon@madhouse-project.org> | |
Thu, 7 Apr 2016 06:59:08 +0000 (08:59 +0200) | ||
committer | Gergely Nagy <algernon@madhouse-project.org> | |
Thu, 7 Apr 2016 06:59:08 +0000 (08:59 +0200) |
Bump the riemann-c-client requirement to 1.8.0, which introduces
riemann_client_set_timeout(). With this in place, the plugin can now
accept the "Timeout" option, which specifies a timeout in seconds, for
all blocking operations (except TLS handshake).
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
riemann_client_set_timeout(). With this in place, the plugin can now
accept the "Timeout" option, which specifies a timeout in seconds, for
all blocking operations (except TLS handshake).
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
configure.ac | patch | blob | history | |
src/write_riemann.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index 09afe112b8af7e6bf496bdd4d141590b30fa36bd..9cc9b552d24ba9a4d12b66d0ac3bd67517e4c696 100644 (file)
--- a/configure.ac
+++ b/configure.ac
[with_libnotify="no (pkg-config doesn't know libnotify)"]
)
-PKG_CHECK_MODULES([RIEMANN_C], [riemann-client >= 1.6.0],
+PKG_CHECK_MODULES([RIEMANN_C], [riemann-client >= 1.8.0],
[with_riemann_c="yes"],
[with_riemann_c="no (pbg-config doesn't know riemann-c-client)"])
diff --git a/src/write_riemann.c b/src/write_riemann.c
index 3429976fd0faff0d8670178f55e0beb6711634dd..2b68e883b400ddf4d9c5cb19002dde60c89a9e83 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
char *tls_ca_file;
char *tls_cert_file;
char *tls_key_file;
+ struct timeval timeout;
};
static char **riemann_tags;
node, port);
return -1;
}
+ if (host->timeout.tv_sec != 0) {
+ if (riemann_client_set_timeout(host->client, &host->timeout) != 0) {
+ riemann_client_free(host->client);
+ host->client = NULL;
+ WARNING("write_riemann plugin: Unable to connect to Riemann at %s:%d",
+ node, port);
+ return -1;
+ }
+ }
DEBUG("write_riemann plugin: got a successful connection for: %s:%d",
node, port);
host->ttl_factor = RIEMANN_TTL_FACTOR;
host->client = NULL;
host->client_type = RIEMANN_CLIENT_TCP;
+ host->timeout.tv_sec = 0;
+ host->timeout.tv_usec = 0;
status = cf_util_get_string(ci, &host->name);
if (status != 0) {
status = cf_util_get_int(child, &host->batch_max);
if (status != 0)
break;
+ } else if (strcasecmp("Timeout", child->key) == 0) {
+ status = cf_util_get_int(child, (int *)&host->timeout.tv_sec);
+ if (status != 0)
+ break;
} else if (strcasecmp("Port", child->key) == 0) {
host->port = cf_util_get_port_number(child);
if (host->port == -1) {