X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Folsrd.c;h=be422ab61068d284ef5f1bbc9455bb7e9a214db4;hb=3b4201d2235c25ed21174c41c526c9b7894de539;hp=123520a47b288e85fe14b2ce5f69a6ae0159363d;hpb=7e1ee1bc185e7638d6dbd643ff61bce340829bc6;p=collectd.git diff --git a/src/olsrd.c b/src/olsrd.c index 123520a4..be422ab6 100644 --- a/src/olsrd.c +++ b/src/olsrd.c @@ -24,8 +24,10 @@ #include "plugin.h" #include -#include #include +#include +#include +#include #define OLSRD_DEFAULT_NODE "localhost" #define OLSRD_DEFAULT_SERVICE "2006" @@ -257,8 +259,8 @@ static int olsrd_cb_links (int lineno, /* {{{ */ static double nlq_sum; static uint32_t nlq_num; - double lq; /* tx */ - double nlq; /* rx */ + double lq; + double nlq; char *endptr; @@ -289,14 +291,14 @@ static int olsrd_cb_links (int lineno, /* {{{ */ lq = lq_sum / ((double) lq_num); DEBUG ("olsrd plugin: Average LQ: %g", lq); olsrd_submit (/* p.-inst = */ "links", /* type = */ "signal_quality", - "average-tx", lq); + "average-lq", lq); nlq = NAN; if (nlq_num > 0) nlq = nlq_sum / ((double) nlq_num); DEBUG ("olsrd plugin: Average NLQ: %g", nlq); olsrd_submit (/* p.-inst = */ "links", /* type = */ "signal_quality", - "average-rx", nlq); + "average-nlq", nlq); return (0); } @@ -325,7 +327,7 @@ static int olsrd_cb_links (int lineno, /* {{{ */ { char type_instance[DATA_MAX_NAME_LEN]; - ssnprintf (type_instance, sizeof (type_instance), "%s-%s-tx", + ssnprintf (type_instance, sizeof (type_instance), "%s-%s-lq", fields[0], fields[1]); DEBUG ("olsrd plugin: links: type_instance = %s; lq = %g;", @@ -554,7 +556,7 @@ static int olsrd_cb_topology (int lineno, /* {{{ */ char type_instance[DATA_MAX_NAME_LEN]; memset (type_instance, 0, sizeof (type_instance)); - ssnprintf (type_instance, sizeof (type_instance), "%s-%s-rx", + ssnprintf (type_instance, sizeof (type_instance), "%s-%s-lq", fields[0], fields[1]); DEBUG ("olsrd plugin: type_instance = %s; lq = %g;", type_instance, lq); olsrd_submit (/* p.-inst = */ "topology", /* type = */ "signal_quality", @@ -578,7 +580,7 @@ static int olsrd_cb_topology (int lineno, /* {{{ */ char type_instance[DATA_MAX_NAME_LEN]; memset (type_instance, 0, sizeof (type_instance)); - ssnprintf (type_instance, sizeof (type_instance), "%s-%s-tx", + ssnprintf (type_instance, sizeof (type_instance), "%s-%s-nlq", fields[0], fields[1]); DEBUG ("olsrd plugin: type_instance = %s; nlq = %g;", type_instance, nlq); olsrd_submit (/* p.-inst = */ "topology", /* type = */ "signal_quality", @@ -651,6 +653,9 @@ static int olsrd_read (void) /* {{{ */ if (fh == NULL) return (-1); + fputs ("\r\n", fh); + fflush (fh); + while (fgets (buffer, sizeof (buffer), fh) != NULL) { buffer_len = strchomp (buffer);