diff --git a/src/olsrd.c b/src/olsrd.c
index 8034dab159f931657e7e8e80341285faf174d38f..bbf387f4123dfe12a375ca85b234fd315843e385 100644 (file)
--- a/src/olsrd.c
+++ b/src/olsrd.c
/**
* collectd - src/olsrd.c
/**
* collectd - src/olsrd.c
- * Copyright (C) 2009 Florian octo Forster
+ * Copyright (C) 2009 Florian octo Forster
*
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; only version 2 of the License is applicable.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
*
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*
* Authors:
*
* Authors:
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
**/
#include "collectd.h"
**/
#include "collectd.h"
#include "plugin.h"
#include <sys/types.h>
#include "plugin.h"
#include <sys/types.h>
-#include <sys/socket.h>
#include <netdb.h>
#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
#define OLSRD_DEFAULT_NODE "localhost"
#define OLSRD_DEFAULT_SERVICE "2006"
#define OLSRD_DEFAULT_NODE "localhost"
#define OLSRD_DEFAULT_SERVICE "2006"
static double nlq_sum;
static uint32_t nlq_num;
static double nlq_sum;
static uint32_t nlq_num;
- double lq; /* tx */
- double nlq; /* rx */
+ double lq;
+ double nlq;
char *endptr;
char *endptr;
lq = lq_sum / ((double) lq_num);
DEBUG ("olsrd plugin: Average LQ: %g", lq);
olsrd_submit (/* p.-inst = */ "links", /* type = */ "signal_quality",
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",
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);
}
return (0);
}
{
char type_instance[DATA_MAX_NAME_LEN];
{
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;",
fields[0], fields[1]);
DEBUG ("olsrd plugin: links: type_instance = %s; lq = %g;",
char type_instance[DATA_MAX_NAME_LEN];
memset (type_instance, 0, sizeof (type_instance));
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",
fields[0], fields[1]);
DEBUG ("olsrd plugin: type_instance = %s; lq = %g;", type_instance, lq);
olsrd_submit (/* p.-inst = */ "topology", /* type = */ "signal_quality",
char type_instance[DATA_MAX_NAME_LEN];
memset (type_instance, 0, sizeof (type_instance));
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",
fields[0], fields[1]);
DEBUG ("olsrd plugin: type_instance = %s; nlq = %g;", type_instance, nlq);
olsrd_submit (/* p.-inst = */ "topology", /* type = */ "signal_quality",