summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c210d9e)
raw | patch | inline | side by side (parent: c210d9e)
author | Florian Forster <octo@collectd.org> | |
Wed, 12 Oct 2016 14:56:58 +0000 (16:56 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 12 Oct 2016 14:56:58 +0000 (16:56 +0200) |
Add a comment reminding us to remove the "handled" metric in a later
major release. Also fixes mixes tab/space indenting.
major release. Also fixes mixes tab/space indenting.
src/nginx.c | patch | blob | history |
diff --git a/src/nginx.c b/src/nginx.c
index c03c67ea5a61613e04c858877e95c3ef2610200f..08c24f9a5b8fb93e6d2a3d0eb00e4bd4818b4f0d 100644 (file)
--- a/src/nginx.c
+++ b/src/nginx.c
#else
static char credentials[1024];
int status = ssnprintf (credentials, sizeof (credentials),
- "%s:%s", user, pass == NULL ? "" : pass);
+ "%s:%s", user, pass == NULL ? "" : pass);
if ((status < 0) || ((size_t) status >= sizeof (credentials)))
{
ERROR ("nginx plugin: Credentials would have been truncated.");
for (int i = 0; i < lines_num; i++)
{
fields_num = strsplit (lines[i], fields,
- (sizeof (fields) / sizeof (fields[0])));
+ (sizeof (fields) / sizeof (fields[0])));
if (fields_num == 3)
{
if ((strcmp (fields[0], "Active") == 0)
- && (strcmp (fields[1], "connections:") == 0))
+ && (strcmp (fields[1], "connections:") == 0))
{
- submit ("nginx_connections", "active", atoll (fields[2]));
+ submit ("nginx_connections", "active", atoll (fields[2]));
}
else if ((atoll (fields[0]) != 0)
- && (atoll (fields[1]) != 0)
- && (atoll (fields[2]) != 0))
+ && (atoll (fields[1]) != 0)
+ && (atoll (fields[2]) != 0))
{
- submit ("connections", "accepted", atoll (fields[0]));
- submit ("connections", "handled", atoll (fields[1]));
- submit ("connections", "failed", (atoll(fields[0]) - atoll (fields[1])));
- submit ("nginx_requests", NULL, atoll (fields[2]));
+ submit ("connections", "accepted", atoll (fields[0]));
+ /* TODO: The legacy metric "handled", which is the sum of "accepted" and
+ * "failed", is reported for backwards compatibility only. Remove in the
+ * next major version. */
+ submit ("connections", "handled", atoll (fields[1]));
+ submit ("connections", "failed", (atoll(fields[0]) - atoll (fields[1])));
+ submit ("nginx_requests", NULL, atoll (fields[2]));
}
}
else if (fields_num == 6)
{
if ((strcmp (fields[0], "Reading:") == 0)
- && (strcmp (fields[2], "Writing:") == 0)
- && (strcmp (fields[4], "Waiting:") == 0))
+ && (strcmp (fields[2], "Writing:") == 0)
+ && (strcmp (fields[4], "Waiting:") == 0))
{
- submit ("nginx_connections", "reading", atoll (fields[1]));
- submit ("nginx_connections", "writing", atoll (fields[3]));
- submit ("nginx_connections", "waiting", atoll (fields[5]));
+ submit ("nginx_connections", "reading", atoll (fields[1]));
+ submit ("nginx_connections", "writing", atoll (fields[3]));
+ submit ("nginx_connections", "waiting", atoll (fields[5]));
}
}
}