#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]));
}
}
}