From 3268a333e4f316d8b744e366df2d58781eabd2e7 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 26 Mar 2007 11:35:15 +0200 Subject: [PATCH] interface plugin: Renamed the `traffic' plugin to `interface'. --- configure.in | 10 ++++----- src/Makefile.am | 46 +++++++++++++++++++++--------------------- src/{traffic.c => interface.c} | 26 ++++++++++++------------ 3 files changed, 41 insertions(+), 41 deletions(-) rename src/{traffic.c => interface.c} (95%) diff --git a/configure.in b/configure.in index 929b3d45..27a6ec48 100644 --- a/configure.in +++ b/configure.in @@ -242,7 +242,7 @@ AC_CHECK_HEADERS(sys/swap.h) AC_CHECK_HEADERS(utmp.h) AC_CHECK_HEADERS(utmpx.h) -# For traffic plugin +# For interface plugin AC_CHECK_HEADERS(ifaddrs.h) AC_CHECK_HEADERS(net/if.h, [], [], [ @@ -385,7 +385,7 @@ AC_CHECK_FUNCS(getutent getutxent) AC_CHECK_FUNCS(quotactl) AC_CHECK_FUNCS(getgrgid getpwuid) -# For traffic module +# For interface module AC_CHECK_FUNCS(getifaddrs) # Check for NAN @@ -1203,6 +1203,7 @@ AC_COLLECTD([email], [disable], [module], [email statistics]) AC_COLLECTD([entropy], [disable], [module], [entropy statistics]) AC_COLLECTD([exec], [disable], [module], [exec of external programs]) AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics]) +AC_COLLECTD([interface], [disable], [module], [interface statistics]) AC_COLLECTD([iptables], [disable], [module], [IPtables statistics]) AC_COLLECTD([irq], [disable], [module], [irq statistics]) AC_COLLECTD([load], [disable], [module], [system load statistics]) @@ -1221,7 +1222,6 @@ AC_COLLECTD([logfile], [disable], [module], [logfile log facility]) AC_COLLECTD([swap], [disable], [module], [swap statistics]) AC_COLLECTD([syslog], [disable], [module], [syslog log facility]) AC_COLLECTD([tape], [disable], [module], [tape statistics]) -AC_COLLECTD([traffic], [disable], [module], [system traffic statistics]) AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin]) AC_COLLECTD([users], [disable], [module], [user count statistics]) AC_COLLECTD([vserver], [disable], [module], [vserver statistics]) @@ -1266,8 +1266,9 @@ Configuration: entropy . . . . . . $enable_entropy exec . . . . . . . $enable_exec hddtemp . . . . . . $enable_hddtemp - irq . . . . . . . . $enable_irq + interface . . . . . $enable_interface iptables . . . . . $enable_iptables + irq . . . . . . . . $enable_irq load . . . . . . . $enable_load mbmon . . . . . . . $enable_mbmon memory . . . . . . $enable_memory @@ -1284,7 +1285,6 @@ Configuration: swap . . . . . . . $enable_swap syslog . . . . . . $enable_syslog tape . . . . . . . $enable_tape - traffic . . . . . . $enable_traffic unixsock . . . . . $enable_unixsock users . . . . . . . $enable_users vserver . . . . . . $enable_vserver diff --git a/src/Makefile.am b/src/Makefile.am index 50432d30..bcbeedf1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -236,6 +236,29 @@ collectd_LDADD += "-dlopen" hddtemp.la collectd_DEPENDENCIES += hddtemp.la endif +if BUILD_MODULE_INTERFACE +pkglib_LTLIBRARIES += interface.la +interface_la_SOURCES = interface.c +interface_la_LDFLAGS = -module -avoid-version +collectd_LDADD += "-dlopen" interface.la +collectd_DEPENDENCIES += interface.la +if BUILD_WITH_LIBKSTAT +interface_la_LDFLAGS += -lkstat +endif +if BUILD_WITH_LIBDEVINFO +interface_la_LDFLAGS += -ldevinfo +endif +if BUILD_WITH_LIBSTATGRAB +if BUILD_WITH_LIBKVM +interface_la_LDFLAGS += -lkvm +endif +if BUILD_WITH_LIBDEVSTAT +interface_la_LDFLAGS += -ldevstat +endif +interface_la_LDFLAGS += -lstatgrab +endif +endif + if BUILD_MODULE_IPTABLES pkglib_LTLIBRARIES += iptables.la iptables_la_SOURCES = iptables.c @@ -462,29 +485,6 @@ collectd_LDADD += "-dlopen" tape.la collectd_DEPENDENCIES += tape.la endif -if BUILD_MODULE_TRAFFIC -pkglib_LTLIBRARIES += traffic.la -traffic_la_SOURCES = traffic.c -traffic_la_LDFLAGS = -module -avoid-version -collectd_LDADD += "-dlopen" traffic.la -collectd_DEPENDENCIES += traffic.la -if BUILD_WITH_LIBKSTAT -traffic_la_LDFLAGS += -lkstat -endif -if BUILD_WITH_LIBDEVINFO -traffic_la_LDFLAGS += -ldevinfo -endif -if BUILD_WITH_LIBSTATGRAB -if BUILD_WITH_LIBKVM -traffic_la_LDFLAGS += -lkvm -endif -if BUILD_WITH_LIBDEVSTAT -traffic_la_LDFLAGS += -ldevstat -endif -traffic_la_LDFLAGS += -lstatgrab -endif -endif - if BUILD_MODULE_UNIXSOCK pkglib_LTLIBRARIES += unixsock.la unixsock_la_SOURCES = unixsock.c diff --git a/src/traffic.c b/src/interface.c similarity index 95% rename from src/traffic.c rename to src/interface.c index dc5daccd..308c48ff 100644 --- a/src/traffic.c +++ b/src/interface.c @@ -1,5 +1,5 @@ /** - * collectd - src/traffic.c + * collectd - src/interface.c * Copyright (C) 2005-2007 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it @@ -59,9 +59,9 @@ #endif /* KERNEL_LINUX */ #if HAVE_GETIFADDRS || KERNEL_LINUX || HAVE_LIBKSTAT || HAVE_LIBSTATGRAB -# define TRAFFIC_HAVE_READ 1 +# define INTERFACE_HAVE_READ 1 #else -# define TRAFFIC_HAVE_READ 0 +# define INTERFACE_HAVE_READ 0 #endif /* @@ -164,7 +164,7 @@ static int interface_config (const char *key, const char *value) } #if HAVE_LIBKSTAT -static int traffic_init (void) +static int interface_init (void) { #if HAVE_LIBKSTAT kstat_t *ksp_chain; @@ -192,7 +192,7 @@ static int traffic_init (void) #endif /* HAVE_LIBKSTAT */ return (0); -} /* int traffic_init */ +} /* int interface_init */ #endif /* HAVE_LIBKSTAT */ /* @@ -215,7 +215,7 @@ static int check_ignore_if (const char *interface) return (1 - if_list_action); } /* int check_ignore_if */ -#if TRAFFIC_HAVE_READ +#if INTERFACE_HAVE_READ static void if_submit (const char *dev, const char *type, unsigned long long rx, unsigned long long tx) @@ -239,7 +239,7 @@ static void if_submit (const char *dev, const char *type, plugin_dispatch_values (type, &vl); } /* void if_submit */ -static int traffic_read (void) +static int interface_read (void) { #if HAVE_GETIFADDRS struct ifaddrs *if_list; @@ -305,7 +305,7 @@ static int traffic_read (void) if ((fh = fopen ("/proc/net/dev", "r")) == NULL) { char errbuf[1024]; - WARNING ("traffic: fopen: %s", + WARNING ("interface plugin: fopen: %s", sstrerror (errno, errbuf, sizeof (errbuf))); return (-1); } @@ -386,8 +386,8 @@ static int traffic_read (void) #endif /* HAVE_LIBSTATGRAB */ return (0); -} /* int traffic_read */ -#endif /* TRAFFIC_HAVE_READ */ +} /* int interface_read */ +#endif /* INTERFACE_HAVE_READ */ void module_register (void) { @@ -399,10 +399,10 @@ void module_register (void) config_keys, config_keys_num); #if HAVE_LIBKSTAT - plugin_register_init ("interface", traffic_init); + plugin_register_init ("interface", interface_init); #endif -#if TRAFFIC_HAVE_READ - plugin_register_read ("interface", traffic_read); +#if INTERFACE_HAVE_READ + plugin_register_read ("interface", interface_read); #endif } -- 2.11.0