Stefan Hacker <stefan.hacker at web.de>
- teamspeak2 plugin.
+Tomasz Pala <gotar at pld-linux.org>
+ - conntrack plugin.
+
Tommie Gannert <d00-tga at d.kth.se>
- PID-file patch.
Name server and resolver statistics from the `statistics-channel'
interface of BIND 9.5, 9,6 and later.
+ - conntrack
+ Number of nf_conntrack entries.
+
- cpu
CPU utilization: Time spent in the system, user, nice, idle, and related
states.
plugin_ascent="no"
plugin_battery="no"
plugin_bind="no"
+plugin_conntrack="no"
plugin_cpu="no"
plugin_cpufreq="no"
plugin_df="no"
if test "x$ac_system" = "xLinux"
then
plugin_battery="yes"
+ plugin_conntrack="yes"
plugin_cpu="yes"
plugin_cpufreq="yes"
plugin_disk="yes"
AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
+AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
AC_PLUGIN([csv], [yes], [CSV output plugin])
ascent . . . . . . . $enable_ascent
battery . . . . . . . $enable_battery
bind . . . . . . . . $enable_bind
+ conntrack . . . . . . $enable_conntrack
cpu . . . . . . . . . $enable_cpu
cpufreq . . . . . . . $enable_cpufreq
csv . . . . . . . . . $enable_csv
'GPRINT:max:MAX:%4.1lf Max,',
'GPRINT:avg:LAST:%4.1lf Last\l'
],
+ conntrack => ['-v', 'Entries',
+ 'DEF:avg={file}:entropy:AVERAGE',
+ 'DEF:min={file}:entropy:MIN',
+ 'DEF:max={file}:entropy:MAX',
+ "AREA:max#$HalfBlue",
+ "AREA:min#$Canvas",
+ "LINE1:avg#$FullBlue:Count",
+ 'GPRINT:min:MIN:%4.0lf Min,',
+ 'GPRINT:avg:AVERAGE:%4.0lf Avg,',
+ 'GPRINT:max:MAX:%4.0lf Max,',
+ 'GPRINT:avg:LAST:%4.0lf Last\l'
+ ],
entropy => ['-v', 'Bits',
'DEF:avg={file}:entropy:AVERAGE',
'DEF:min={file}:entropy:MIN',
RRDVerticalLabel "Queries/s"
RRDFormat "%6.1lf"
</Type>
+<Type conntrack>
+ DataSources conntrack
+ DSName conntrack Conntrack count
+ RRDTitle "nf_conntrack connections on {hostname}"
+ RRDVerticalLabel "Count"
+ RRDFormat "%4.0lf"
+</Type>
<Type entropy>
DataSources entropy
DSName entropy Entropy bits
%attr(0644,root,root) %{_libdir}/%{name}/battery.so*
%attr(0644,root,root) %{_libdir}/%{name}/battery.la
+%attr(0644,root,root) %{_libdir}/%{name}/conntrack.so*
+%attr(0644,root,root) %{_libdir}/%{name}/conntrack.la
+
%attr(0644,root,root) %{_libdir}/%{name}/cpufreq.so*
%attr(0644,root,root) %{_libdir}/%{name}/cpufreq.la
'GPRINT:avg:AVERAGE:%4.1lf Avg,',
'GPRINT:max:MAX:%4.1lf Max,',
'GPRINT:avg:LAST:%4.1lf Last\l');
+ $GraphDefs['conntrack'] = array(
+ '-v', 'Entries',
+ 'DEF:avg={file}:entropy:AVERAGE',
+ 'DEF:min={file}:entropy:MIN',
+ 'DEF:max={file}:entropy:MAX',
+ "AREA:max#$HalfBlue",
+ "AREA:min#$Canvas",
+ "LINE1:avg#$FullBlue:Count",
+ 'GPRINT:min:MIN:%4.0lf Min,',
+ 'GPRINT:avg:AVERAGE:%4.0lf Avg,',
+ 'GPRINT:max:MAX:%4.0lf Max,',
+ 'GPRINT:avg:LAST:%4.0lf Last\l');
$GraphDefs['entropy'] = array(
'-v', 'Bits',
'DEF:avg={file}:entropy:AVERAGE',
LoadPlugin apcups
#LoadPlugin apple_sensors
LoadPlugin battery
+LoadPlugin conntrack
LoadPlugin cpu
LoadPlugin cpufreq
LoadPlugin csv
%attr(0644,root,root) %{_libdir}/%{name}/battery.so*
%attr(0644,root,root) %{_libdir}/%{name}/battery.la
+%attr(0644,root,root) %{_libdir}/%{name}/conntrack.so*
+%attr(0644,root,root) %{_libdir}/%{name}/conntrack.la
+
%attr(0644,root,root) %{_libdir}/%{name}/cpufreq.so*
%attr(0644,root,root) %{_libdir}/%{name}/cpufreq.la
collectd_DEPENDENCIES += bind.la
endif
+if BUILD_PLUGIN_CONNTRACK
+pkglib_LTLIBRARIES += conntrack.la
+conntrack_la_SOURCES = conntrack.c
+conntrack_la_LDFLAGS = -module -avoid-version
+collectd_LDADD += "-dlopen" conntrack.la
+collectd_DEPENDENCIES += conntrack.la
+endif
+
if BUILD_PLUGIN_CPU
pkglib_LTLIBRARIES += cpu.la
cpu_la_SOURCES = cpu.c
#@BUILD_PLUGIN_ASCENT_TRUE@LoadPlugin ascent
#@BUILD_PLUGIN_BATTERY_TRUE@LoadPlugin battery
#@BUILD_PLUGIN_BIND_TRUE@LoadPlugin bind
+#@BUILD_PLUGIN_CONNTRACK_TRUE@LoadPlugin conntrack
@BUILD_PLUGIN_CPU_TRUE@@BUILD_PLUGIN_CPU_TRUE@LoadPlugin cpu
#@BUILD_PLUGIN_CPUFREQ_TRUE@LoadPlugin cpufreq
@LOAD_PLUGIN_CSV@LoadPlugin csv
--- /dev/null
+/**
+ * collectd - src/conntrack.c
+ * Copyright (C) 2009 Tomasz Pala
+ *
+ * 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
+ *
+ * Authors:
+ * Tomasz Pala <gotar at pld-linux.org>
+ * based on entropy.c by:
+ * Florian octo Forster <octo at verplant.org>
+ **/
+
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
+
+#if !KERNEL_LINUX
+# error "No applicable input method."
+#endif
+
+#define CONNTRACK_FILE "/proc/sys/net/netfilter/nf_conntrack_count"
+
+static void conntrack_submit (double conntrack)
+{
+ value_t values[1];
+ value_list_t vl = VALUE_LIST_INIT;
+
+ values[0].gauge = conntrack;
+
+ vl.values = values;
+ vl.values_len = 1;
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "conntrack", sizeof (vl.plugin));
+ sstrncpy (vl.type, "conntrack", sizeof (vl.type));
+
+ plugin_dispatch_values (&vl);
+} /* static void conntrack_submit */
+
+static int conntrack_read (void)
+{
+ double conntrack;
+ FILE *fh;
+ char buffer[64];
+
+ fh = fopen (CONNTRACK_FILE, "r");
+ if (fh == NULL)
+ return (-1);
+
+ if (fgets (buffer, sizeof (buffer), fh) == NULL)
+ {
+ fclose (fh);
+ return (-1);
+ }
+ fclose (fh);
+
+ conntrack = atof (buffer);
+
+ if (conntrack > 0.0)
+ conntrack_submit (conntrack);
+
+ return (0);
+} /* static int conntrack_read */
+
+void module_register (void)
+{
+ plugin_register_read ("conntrack", conntrack_read);
+} /* void module_register */
charge value:GAUGE:0:U
compression_ratio value:GAUGE:0:2
connections value:COUNTER:0:U
+conntrack entropy:GAUGE:0:4294967295
counter value:COUNTER:U:U
cpufreq value:GAUGE:0:U
cpu value:COUNTER:0:4294967295