=back
+=head2 Plugin C<conntrack>
+
+This plugin collects IP conntrack statistics.
+
+=over 4
+
+=item B<OldFiles>
+
+Assume the B<conntrack_count> and B<conntrack_max> files to be found in
+F</proc/sys/net/ipv4/netfilter> instead of F</proc/sys/net/netfilter/>.
+
+=back
+
=head2 Plugin C<cpu>
The I<CPU plugin> collects CPU usage metrics.
#define CONNTRACK_FILE "/proc/sys/net/netfilter/nf_conntrack_count"
#define CONNTRACK_MAX_FILE "/proc/sys/net/netfilter/nf_conntrack_max"
+#define CONNTRACK_FILE_OLD "/proc/sys/net/ipv4/netfilter/ip_conntrack_count"
+#define CONNTRACK_MAX_FILE_OLD "/proc/sys/net/ipv4/netfilter/ip_conntrack_max"
+
+static const char *config_keys[] =
+{
+ "OldFiles"
+};
+static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
+/*
+ Each table/chain combo that will be queried goes into this list
+*/
+
+static int old_files = 0;
+
+static int conntrack_config(const char *key, const char *value)
+{
+ if (strcmp(key, "OldFiles") == 0)
+ old_files = 1;
+
+ return 0;
+}
static void conntrack_submit (const char *type, const char *type_instance,
value_t conntrack)
char buffer[64];
size_t buffer_len;
- fh = fopen (CONNTRACK_FILE, "r");
+ fh = fopen (old_files?CONNTRACK_FILE_OLD:CONNTRACK_FILE, "r");
if (fh == NULL)
return (-1);
conntrack_submit ("conntrack", NULL, conntrack);
- fh = fopen (CONNTRACK_MAX_FILE, "r");
+ fh = fopen (old_files?CONNTRACK_MAX_FILE_OLD:CONNTRACK_MAX_FILE, "r");
if (fh == NULL)
return (-1);
void module_register (void)
{
+ plugin_register_config ("conntrack", conntrack_config,
+ config_keys, config_keys_num);
plugin_register_read ("conntrack", conntrack_read);
} /* void module_register */