mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
collectd: import from packages, add myself as maintainer
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
--- /dev/null
|
||||
+++ b/fake-am_path_libgcrypt.m4
|
||||
@@ -0,0 +1 @@
|
||||
+AC_DEFUN([AM_PATH_LIBGCRYPT],[:])
|
||||
@@ -0,0 +1,66 @@
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -7,7 +7,7 @@ SUBDIRS += liboconfig
|
||||
endif
|
||||
|
||||
if COMPILER_IS_GCC
|
||||
-AM_CFLAGS = -Wall -Werror
|
||||
+AM_CFLAGS = -Wall
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = -DPREFIX='"${prefix}"'
|
||||
--- a/src/Makefile.in
|
||||
+++ b/src/Makefile.in
|
||||
@@ -1833,7 +1833,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = libcollectdclient $(am__append_1) $(am__append_2)
|
||||
-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror
|
||||
+@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall
|
||||
AM_CPPFLAGS = -DPREFIX='"${prefix}"' \
|
||||
-DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \
|
||||
-DLOCALSTATEDIR='"${localstatedir}"' \
|
||||
--- a/src/libcollectdclient/Makefile.am
|
||||
+++ b/src/libcollectdclient/Makefile.am
|
||||
@@ -1,7 +1,7 @@
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
|
||||
if COMPILER_IS_GCC
|
||||
-AM_CFLAGS = -Wall -Werror
|
||||
+AM_CFLAGS = -Wall
|
||||
endif
|
||||
|
||||
pkginclude_HEADERS = client.h lcc_features.h
|
||||
--- a/src/libcollectdclient/Makefile.in
|
||||
+++ b/src/libcollectdclient/Makefile.in
|
||||
@@ -327,7 +327,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror
|
||||
+@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall
|
||||
pkginclude_HEADERS = client.h lcc_features.h
|
||||
lib_LTLIBRARIES = libcollectdclient.la
|
||||
nodist_pkgconfig_DATA = libcollectdclient.pc
|
||||
--- a/src/owniptc/Makefile.am
|
||||
+++ b/src/owniptc/Makefile.am
|
||||
@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = foreign no-dependenci
|
||||
EXTRA_DIST = libiptc.c README.collectd
|
||||
|
||||
if COMPILER_IS_GCC
|
||||
-AM_CFLAGS = -Wall -Werror
|
||||
+AM_CFLAGS = -Wall
|
||||
endif
|
||||
|
||||
noinst_LTLIBRARIES = libiptc.la
|
||||
--- a/src/owniptc/Makefile.in
|
||||
+++ b/src/owniptc/Makefile.in
|
||||
@@ -296,7 +296,7 @@ top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
EXTRA_DIST = libiptc.c README.collectd
|
||||
-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror
|
||||
+@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall
|
||||
noinst_LTLIBRARIES = libiptc.la
|
||||
libiptc_la_SOURCES = libip4tc.c libip6tc.c \
|
||||
ipt_kernel_headers.h libip6tc.h libiptc.h linux_list.h \
|
||||
@@ -0,0 +1,57 @@
|
||||
--- a/src/rrdtool.c
|
||||
+++ b/src/rrdtool.c
|
||||
@@ -80,6 +80,7 @@ static const char *config_keys[] =
|
||||
"HeartBeat",
|
||||
"RRARows",
|
||||
"RRATimespan",
|
||||
+ "RRASingle",
|
||||
"XFF",
|
||||
"WritesPerSecond",
|
||||
"RandomTimeout"
|
||||
@@ -101,6 +102,8 @@ static rrdcreate_config_t rrdcreate_conf
|
||||
/* timespans = */ NULL,
|
||||
/* timespans_num = */ 0,
|
||||
|
||||
+ /* rrasingle = */ 0,
|
||||
+
|
||||
/* consolidation_functions = */ NULL,
|
||||
/* consolidation_functions_num = */ 0
|
||||
};
|
||||
@@ -1027,6 +1030,14 @@ static int rrd_config (const char *key,
|
||||
|
||||
free (value_copy);
|
||||
}
|
||||
+ else if (strcasecmp ("RRASingle", key) == 0)
|
||||
+ {
|
||||
+ if (IS_TRUE (value))
|
||||
+ {
|
||||
+ rrdcreate_config.rrasingle = 1;
|
||||
+ NOTICE ("rrdtool plugin: RRASingle = true: creating only AVERAGE RRAs");
|
||||
+ }
|
||||
+ }
|
||||
else if (strcasecmp ("XFF", key) == 0)
|
||||
{
|
||||
double tmp = atof (value);
|
||||
--- a/src/utils_rrdcreate.c
|
||||
+++ b/src/utils_rrdcreate.c
|
||||
@@ -122,6 +122,9 @@ static int rra_get (char ***ret, const v
|
||||
rts_num = rra_timespans_num;
|
||||
}
|
||||
|
||||
+ if (cfg->rrasingle)
|
||||
+ rra_types_num = 1;
|
||||
+
|
||||
rra_max = rts_num * rra_types_num;
|
||||
|
||||
if ((rra_def = (char **) malloc ((rra_max + 1) * sizeof (char *))) == NULL)
|
||||
--- a/src/utils_rrdcreate.h
|
||||
+++ b/src/utils_rrdcreate.h
|
||||
@@ -36,6 +36,8 @@ struct rrdcreate_config_s
|
||||
int *timespans;
|
||||
size_t timespans_num;
|
||||
|
||||
+ int rrasingle;
|
||||
+
|
||||
char **consolidation_functions;
|
||||
size_t consolidation_functions_num;
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
src/interface.c | 33 ++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/interface.c
|
||||
+++ b/src/interface.c
|
||||
@@ -203,7 +203,38 @@ static int interface_read (void)
|
||||
# define IFA_RX_ERROR rx_errors
|
||||
# define IFA_TX_ERROR tx_errors
|
||||
#else
|
||||
-# error "No suitable type for `struct ifaddrs->ifa_data' found."
|
||||
+struct net_device_stats {
|
||||
+ unsigned long rx_packets;
|
||||
+ unsigned long tx_packets;
|
||||
+ unsigned long rx_bytes;
|
||||
+ unsigned long tx_bytes;
|
||||
+ unsigned long rx_errors;
|
||||
+ unsigned long tx_errors;
|
||||
+ unsigned long rx_dropped;
|
||||
+ unsigned long tx_dropped;
|
||||
+ unsigned long multicast;
|
||||
+ unsigned long collisions;
|
||||
+ unsigned long rx_length_errors;
|
||||
+ unsigned long rx_over_errors;
|
||||
+ unsigned long rx_crc_errors;
|
||||
+ unsigned long rx_frame_errors;
|
||||
+ unsigned long rx_fifo_errors;
|
||||
+ unsigned long rx_missed_errors;
|
||||
+ unsigned long tx_aborted_errors;
|
||||
+ unsigned long tx_carrier_errors;
|
||||
+ unsigned long tx_fifo_errors;
|
||||
+ unsigned long tx_heartbeat_errors;
|
||||
+ unsigned long tx_window_errors;
|
||||
+ unsigned long rx_compressed;
|
||||
+ unsigned long tx_compressed;
|
||||
+};
|
||||
+# define IFA_DATA net_device_stats
|
||||
+# define IFA_RX_BYTES rx_bytes
|
||||
+# define IFA_TX_BYTES tx_bytes
|
||||
+# define IFA_RX_PACKT rx_packets
|
||||
+# define IFA_TX_PACKT tx_packets
|
||||
+# define IFA_RX_ERROR rx_errors
|
||||
+# define IFA_TX_ERROR tx_errors
|
||||
#endif
|
||||
|
||||
struct IFA_DATA *if_data;
|
||||
@@ -0,0 +1,78 @@
|
||||
--- a/src/owniptc/libiptc.c
|
||||
+++ b/src/owniptc/libiptc.c
|
||||
@@ -81,11 +81,11 @@ static const char *hooknames[] = {
|
||||
};
|
||||
|
||||
/* Convenience structures */
|
||||
-struct ipt_error_target
|
||||
+ struct ipt_error_target2
|
||||
{
|
||||
STRUCT_ENTRY_TARGET t;
|
||||
char error[TABLE_MAXNAMELEN];
|
||||
-};
|
||||
+};
|
||||
|
||||
struct chain_head;
|
||||
struct rule_head;
|
||||
@@ -1007,10 +1007,10 @@ static int parse_table(TC_HANDLE_T h)
|
||||
/* Convenience structures */
|
||||
struct iptcb_chain_start{
|
||||
STRUCT_ENTRY e;
|
||||
- struct ipt_error_target name;
|
||||
+ struct ipt_error_target2 name;
|
||||
};
|
||||
#define IPTCB_CHAIN_START_SIZE (sizeof(STRUCT_ENTRY) + \
|
||||
- ALIGN(sizeof(struct ipt_error_target)))
|
||||
+ ALIGN(sizeof(struct ipt_error_target2)))
|
||||
|
||||
struct iptcb_chain_foot {
|
||||
STRUCT_ENTRY e;
|
||||
@@ -1021,10 +1021,10 @@ struct iptcb_chain_foot {
|
||||
|
||||
struct iptcb_chain_error {
|
||||
STRUCT_ENTRY entry;
|
||||
- struct ipt_error_target target;
|
||||
+ struct ipt_error_target2 target;
|
||||
};
|
||||
#define IPTCB_CHAIN_ERROR_SIZE (sizeof(STRUCT_ENTRY) + \
|
||||
- ALIGN(sizeof(struct ipt_error_target)))
|
||||
+ ALIGN(sizeof(struct ipt_error_target2)))
|
||||
|
||||
|
||||
|
||||
@@ -1069,7 +1069,7 @@ static int iptcc_compile_chain(TC_HANDLE
|
||||
head->e.next_offset = IPTCB_CHAIN_START_SIZE;
|
||||
strcpy(head->name.t.u.user.name, ERROR_TARGET);
|
||||
head->name.t.u.target_size =
|
||||
- ALIGN(sizeof(struct ipt_error_target));
|
||||
+ ALIGN(sizeof(struct ipt_error_target2));
|
||||
strcpy(head->name.error, c->name);
|
||||
} else {
|
||||
repl->hook_entry[c->hooknum-1] = c->head_offset;
|
||||
@@ -1113,7 +1113,7 @@ static int iptcc_compile_chain_offsets(T
|
||||
if (!iptcc_is_builtin(c)) {
|
||||
/* Chain has header */
|
||||
*offset += sizeof(STRUCT_ENTRY)
|
||||
- + ALIGN(sizeof(struct ipt_error_target));
|
||||
+ + ALIGN(sizeof(struct ipt_error_target2));
|
||||
(*num)++;
|
||||
}
|
||||
|
||||
@@ -1153,7 +1153,7 @@ static int iptcc_compile_table_prep(TC_H
|
||||
/* Append one error rule at end of chain */
|
||||
num++;
|
||||
offset += sizeof(STRUCT_ENTRY)
|
||||
- + ALIGN(sizeof(struct ipt_error_target));
|
||||
+ + ALIGN(sizeof(struct ipt_error_target2));
|
||||
|
||||
/* ruleset size is now in offset */
|
||||
*size = offset;
|
||||
@@ -1177,7 +1177,7 @@ static int iptcc_compile_table(TC_HANDLE
|
||||
error->entry.target_offset = sizeof(STRUCT_ENTRY);
|
||||
error->entry.next_offset = IPTCB_CHAIN_ERROR_SIZE;
|
||||
error->target.t.u.user.target_size =
|
||||
- ALIGN(sizeof(struct ipt_error_target));
|
||||
+ ALIGN(sizeof(struct ipt_error_target2));
|
||||
strcpy((char *)&error->target.t.u.user.name, ERROR_TARGET);
|
||||
strcpy((char *)&error->target.error, "ERROR");
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
Derived from uptream commit d5b09f2b: http://octo.cx/d5b09f2
|
||||
|
||||
--- a/src/types.db
|
||||
+++ b/src/types.db
|
||||
@@ -152,7 +152,7 @@ tcp_connections value:GAUGE:0:429496729
|
||||
temperature value:GAUGE:-273.15:U
|
||||
threads value:GAUGE:0:U
|
||||
time_dispersion seconds:GAUGE:-1000000:1000000
|
||||
-timeleft timeleft:GAUGE:0:3600
|
||||
+timeleft timeleft:GAUGE:0:U
|
||||
time_offset seconds:GAUGE:-1000000:1000000
|
||||
total_bytes value:DERIVE:0:U
|
||||
total_requests value:DERIVE:0:U
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/version-gen.sh
|
||||
+++ b/version-gen.sh
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
DEFAULT_VERSION="4.10.8.git"
|
||||
|
||||
-VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
|
||||
+#VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
|
||||
|
||||
if test -z "$VERSION"; then
|
||||
VERSION="$DEFAULT_VERSION"
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/olsrd.c
|
||||
+++ b/src/olsrd.c
|
||||
@@ -653,7 +653,7 @@ static int olsrd_read (void) /* {{{ */
|
||||
if (fh == NULL)
|
||||
return (-1);
|
||||
|
||||
- fputs ("\r\n", fh);
|
||||
+ fputs ("/all \r\n", fh);
|
||||
fflush (fh);
|
||||
|
||||
while (fgets (buffer, sizeof (buffer), fh) != NULL)
|
||||
@@ -0,0 +1,275 @@
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -490,6 +490,9 @@ AC_CHECK_HEADERS(netinet/if_ether.h, [],
|
||||
have_termios_h="no"
|
||||
AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
|
||||
|
||||
+# For the iwinfo plugin
|
||||
+AC_CHECK_LIB(iwinfo, iwinfo_backend, [with_iwinfo="yes"], [with_iwinfo="no (libiwinfo not found)"], [])
|
||||
+
|
||||
#
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
#
|
||||
@@ -4081,6 +4084,7 @@ plugin_interface="no"
|
||||
plugin_ipmi="no"
|
||||
plugin_ipvs="no"
|
||||
plugin_irq="no"
|
||||
+plugin_iwinfo="no"
|
||||
plugin_libvirt="no"
|
||||
plugin_load="no"
|
||||
plugin_memory="no"
|
||||
@@ -4388,6 +4392,7 @@ AC_PLUGIN([ipmi], [$plugin_ipmi],
|
||||
AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
|
||||
AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
|
||||
AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
|
||||
+AC_PLUGIN([iwinfo], [$with_iwinfo], [Common iwinfo wireless statistics])
|
||||
AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
|
||||
AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
|
||||
AC_PLUGIN([load], [$plugin_load], [System load])
|
||||
@@ -4666,6 +4671,7 @@ Configuration:
|
||||
protobuf-c . . . . . $have_protoc_c
|
||||
oracle . . . . . . . $with_oracle
|
||||
python . . . . . . . $with_python
|
||||
+ iwinfo . . . . . . . $with_iwinfo
|
||||
|
||||
Features:
|
||||
daemon mode . . . . . $enable_daemon
|
||||
@@ -4705,6 +4711,7 @@ Configuration:
|
||||
iptables . . . . . . $enable_iptables
|
||||
ipvs . . . . . . . . $enable_ipvs
|
||||
irq . . . . . . . . . $enable_irq
|
||||
+ iwinfo . . . . . . . $enable_iwinfo
|
||||
java . . . . . . . . $enable_java
|
||||
libvirt . . . . . . . $enable_libvirt
|
||||
load . . . . . . . . $enable_load
|
||||
--- a/src/collectd.conf.in
|
||||
+++ b/src/collectd.conf.in
|
||||
@@ -82,6 +82,7 @@ FQDNLookup true
|
||||
#@BUILD_PLUGIN_IPMI_TRUE@LoadPlugin ipmi
|
||||
#@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs
|
||||
#@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq
|
||||
+#@BUILD_PLUGIN_IWINFO_TRUE@LoadPlugin iwinfo
|
||||
#@BUILD_PLUGIN_JAVA_TRUE@LoadPlugin java
|
||||
#@BUILD_PLUGIN_LIBVIRT_TRUE@LoadPlugin libvirt
|
||||
@BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load
|
||||
@@ -376,6 +377,12 @@ FQDNLookup true
|
||||
# IgnoreSelected true
|
||||
#</Plugin>
|
||||
|
||||
+#<Plugin iwinfo>
|
||||
+# Interface "ath0"
|
||||
+# Interface "ra0"
|
||||
+# Interface "wlan0"
|
||||
+#</Plugin>
|
||||
+
|
||||
#<Plugin "java">
|
||||
# JVMArg "-verbose:jni"
|
||||
# JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar"
|
||||
--- a/src/collectd.conf.pod
|
||||
+++ b/src/collectd.conf.pod
|
||||
@@ -1478,6 +1478,27 @@ and all other interrupts are collected.
|
||||
|
||||
=back
|
||||
|
||||
+=head2 Plugin C<iwinfo>
|
||||
+
|
||||
+=over 4
|
||||
+
|
||||
+=item B<Interface> I<Interface>
|
||||
+
|
||||
+Select this interface. By default all detected wireless interfaces will be
|
||||
+collected. For a more detailed description see B<IgnoreSelected> below.
|
||||
+
|
||||
+=item B<IgnoreSelected> I<true>|I<false>
|
||||
+
|
||||
+If no configuration if given, the B<iwinfo>-plugin will collect data from all
|
||||
+detected wireless interfaces. You can use the B<Interface>-option to pick the
|
||||
+interfaces you're interested in. Sometimes, however, it's easier/preferred to
|
||||
+collect all interfaces I<except> a few ones. This option enables you to do
|
||||
+that: By setting B<IgnoreSelected> to I<true> the effect of B<Interface> is
|
||||
+inverted: All selected interfaces are ignored and all other interfaces are
|
||||
+collected.
|
||||
+
|
||||
+=back
|
||||
+
|
||||
=head2 Plugin C<java>
|
||||
|
||||
The I<Java> plugin makes it possible to write extensions for collectd in Java.
|
||||
--- /dev/null
|
||||
+++ b/src/iwinfo.c
|
||||
@@ -0,0 +1,150 @@
|
||||
+/**
|
||||
+ * collectd - src/iwinfo.c
|
||||
+ * Copyright (C) 2011 Jo-Philipp Wich
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * 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
|
||||
+ **/
|
||||
+
|
||||
+#include "collectd.h"
|
||||
+#include "common.h"
|
||||
+#include "plugin.h"
|
||||
+#include "utils_ignorelist.h"
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <iwinfo.h>
|
||||
+
|
||||
+#define PROCNETDEV "/proc/net/dev"
|
||||
+
|
||||
+static const char *config_keys[] = {
|
||||
+ "Interface",
|
||||
+ "IgnoreSelected"
|
||||
+};
|
||||
+static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
|
||||
+
|
||||
+static ignorelist_t *ignorelist = NULL;
|
||||
+
|
||||
+static int iwinfo_config(const char *key, const char *value)
|
||||
+{
|
||||
+ if (ignorelist == NULL)
|
||||
+ ignorelist = ignorelist_create(1);
|
||||
+
|
||||
+ if (ignorelist == NULL)
|
||||
+ return 1;
|
||||
+
|
||||
+ if (strcasecmp(key, "Interface") == 0)
|
||||
+ ignorelist_add(ignorelist, value);
|
||||
+ else if (strcasecmp(key, "IgnoreSelected") == 0)
|
||||
+ ignorelist_set_invert(ignorelist, IS_TRUE(value) ? 0 : 1);
|
||||
+ else
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void iwinfo_submit(const char *ifname, const char *type, int value)
|
||||
+{
|
||||
+ value_t values[1];
|
||||
+ value_list_t vl = VALUE_LIST_INIT;
|
||||
+
|
||||
+ values[0].gauge = value;
|
||||
+
|
||||
+ vl.values = values;
|
||||
+ vl.values_len = 1;
|
||||
+
|
||||
+ sstrncpy(vl.host, hostname_g, sizeof(vl.host));
|
||||
+ sstrncpy(vl.plugin, "iwinfo", sizeof(vl.plugin));
|
||||
+ sstrncpy(vl.plugin_instance, ifname, sizeof(vl.plugin_instance));
|
||||
+ sstrncpy(vl.type, type, sizeof(vl.type));
|
||||
+ /*sstrncpy(vl.type_instance, "", sizeof(vl.type_instance));*/
|
||||
+
|
||||
+ plugin_dispatch_values(&vl);
|
||||
+}
|
||||
+
|
||||
+static void iwinfo_process(const char *ifname)
|
||||
+{
|
||||
+ int val;
|
||||
+ char buf[IWINFO_BUFSIZE];
|
||||
+ const struct iwinfo_ops *iw = iwinfo_backend(ifname);
|
||||
+
|
||||
+ /* does appear to be a wifi iface */
|
||||
+ if (iw)
|
||||
+ {
|
||||
+ if (iw->bitrate(ifname, &val))
|
||||
+ val = 0;
|
||||
+ iwinfo_submit(ifname, "bitrate", val * 1000);
|
||||
+
|
||||
+ if (iw->signal(ifname, &val))
|
||||
+ val = 0;
|
||||
+ iwinfo_submit(ifname, "signal_power", val);
|
||||
+
|
||||
+ if (iw->noise(ifname, &val))
|
||||
+ val = 0;
|
||||
+ iwinfo_submit(ifname, "signal_noise", val);
|
||||
+
|
||||
+ if (iw->quality(ifname, &val))
|
||||
+ val = 0;
|
||||
+ iwinfo_submit(ifname, "signal_quality", val);
|
||||
+
|
||||
+ if (iw->assoclist(ifname, buf, &val))
|
||||
+ val = 0;
|
||||
+ iwinfo_submit(ifname, "stations",
|
||||
+ val / sizeof(struct iwinfo_assoclist_entry));
|
||||
+ }
|
||||
+
|
||||
+ iwinfo_finish();
|
||||
+}
|
||||
+
|
||||
+static int iwinfo_read(void)
|
||||
+{
|
||||
+ char line[1024];
|
||||
+ char ifname[128];
|
||||
+ FILE *f;
|
||||
+
|
||||
+ f = fopen(PROCNETDEV, "r");
|
||||
+ if (f == NULL)
|
||||
+ {
|
||||
+ char err[1024];
|
||||
+ WARNING("iwinfo: Unable to open " PROCNETDEV ": %s",
|
||||
+ sstrerror(errno, err, sizeof(err)));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ while (fgets(line, sizeof(line), f))
|
||||
+ {
|
||||
+ if (!strchr(line, ':'))
|
||||
+ continue;
|
||||
+
|
||||
+ if (!sscanf(line, " %127[^:]", ifname))
|
||||
+ continue;
|
||||
+
|
||||
+ if (ignorelist_match(ignorelist, ifname))
|
||||
+ continue;
|
||||
+
|
||||
+ if (strstr(ifname, "mon.") || strstr(ifname, ".sta") ||
|
||||
+ strstr(ifname, "tmp.") || strstr(ifname, "wifi"))
|
||||
+ continue;
|
||||
+
|
||||
+ iwinfo_process(ifname);
|
||||
+ }
|
||||
+
|
||||
+ fclose(f);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void module_register(void)
|
||||
+{
|
||||
+ plugin_register_config("iwinfo", iwinfo_config, config_keys, config_keys_num);
|
||||
+ plugin_register_read("iwinfo", iwinfo_read);
|
||||
+}
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -453,6 +453,15 @@ collectd_LDADD += "-dlopen" irq.la
|
||||
collectd_DEPENDENCIES += irq.la
|
||||
endif
|
||||
|
||||
+if BUILD_PLUGIN_IWINFO
|
||||
+pkglib_LTLIBRARIES += iwinfo.la
|
||||
+iwinfo_la_SOURCES = iwinfo.c
|
||||
+iwinfo_la_LDFLAGS = -module -avoid-version
|
||||
+iwinfo_la_LIBADD = -liwinfo
|
||||
+collectd_LDADD += "-dlopen" iwinfo.la
|
||||
+collectd_DEPENDENCIES += iwinfo.la
|
||||
+endif
|
||||
+
|
||||
if BUILD_PLUGIN_JAVA
|
||||
pkglib_LTLIBRARIES += java.la
|
||||
java_la_SOURCES = java.c
|
||||
--- a/src/types.db
|
||||
+++ b/src/types.db
|
||||
@@ -171,3 +171,4 @@ voltage value:GAUGE:U:U
|
||||
vs_memory value:GAUGE:0:9223372036854775807
|
||||
vs_processes value:GAUGE:0:65535
|
||||
vs_threads value:GAUGE:0:65535
|
||||
+stations value:GAUGE:0:256
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/ping.c
|
||||
+++ b/src/ping.c
|
||||
@@ -651,7 +651,7 @@ static int ping_read (void) /* {{{ */
|
||||
/ ((double) (pkg_recv * (pkg_recv - 1))));
|
||||
|
||||
/* Calculate drop rate. */
|
||||
- droprate = ((double) (pkg_sent - pkg_recv)) / ((double) pkg_sent);
|
||||
+ droprate = ((double) (pkg_sent - pkg_recv)) * 100 / ((double) pkg_sent);
|
||||
|
||||
submit (hl->host, "ping", latency_average);
|
||||
submit (hl->host, "ping_stddev", latency_stddev);
|
||||
Reference in New Issue
Block a user