Only in src: apcups.la
Only in src: apcups.lo
Only in src: apcups.o
Only in src: battery.la
Only in src: battery.lo
Only in src: battery.o
Only in src: collectd
Only in src: collectd-collectd.o
Only in src: collectd-common.o
Only in src: collectd.conf
Only in src: collectd-configfile.o
Only in src: collectd-filter_chain.o
Only in src: collectd-meta_data.o
Only in src: collectdmon
Only in src: collectdmon-collectdmon.o
Only in src: collectd-nagios
Only in src: collectd-nagios.o
Only in src: collectd-plugin.o
Only in src: collectd-types_list.o
Only in src: collectd-utils_avltree.o
Only in src: collectd-utils_cache.o
Only in src: collectd-utils_complain.o
Only in src: collectd-utils_heap.o
Only in src: collectd-utils_ignorelist.o
Only in src: collectd-utils_llist.o
Only in src: collectd-utils_match.o
Only in src: collectd-utils_parse_option.o
Only in src: collectd-utils_subst.o
Only in src: collectd-utils_tail_match.o
Only in src: collectd-utils_tail.o
Only in src: collectd-utils_threshold.o
diff -ur src.orig/configfile.c src/configfile.c
--- src.orig/configfile.c	2010-07-09 12:02:00.000000000 +0200
+++ src/configfile.c	2011-02-21 14:49:15.315365000 +0100
@@ -70,6 +70,19 @@
 	char *def;
 } cf_global_option_t;
 
+typedef struct cf_plugin_global_value_s
+{
+	char *plugin;
+	char *value;
+	struct cf_plugin_global_value_s *next;
+} cf_plugin_global_value_t;
+
+typedef struct cf_plugin_global_option_s
+{
+	char *key;
+	cf_plugin_global_value_t *values;
+} cf_plugin_global_option_t;
+
 /*
  * Prototypes of callback functions
  */
@@ -105,6 +118,12 @@
 };
 static int cf_global_options_num = STATIC_ARRAY_LEN (cf_global_options);
 
+static cf_plugin_global_option_t cf_plugin_global_options[] =
+{
+	{"Interval", NULL}
+};
+static int cf_plugin_global_options_num = STATIC_ARRAY_LEN (cf_plugin_global_options);
+
 static int cf_default_typesdb = 1;
 
 /*
@@ -178,27 +197,39 @@
 	return (ret);
 } /* int cf_dispatch */
 
+static char *config_item_to_char(const oconfig_item_t *ci, char *tmp, int tmpSize)
+{
+	if (ci->values_num == 1) {
+		if (ci->values[0].type == OCONFIG_TYPE_STRING)
+			return (ci->values[0].value.string);
+		else if (ci->values[0].type == OCONFIG_TYPE_NUMBER)
+		{
+			ssnprintf (tmp, tmpSize, "%lf", ci->values[0].value.number);
+			return (tmp);
+		}
+		else if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN)
+		{
+			if (ci->values[0].value.boolean)
+				return ("true");
+			else
+				return ("false");
+		}
+	}
+	return (NULL);
+} /* char *config_item_to_char */
+
 static int dispatch_global_option (const oconfig_item_t *ci)
 {
-	if (ci->values_num != 1)
-		return (-1);
-	if (ci->values[0].type == OCONFIG_TYPE_STRING)
-		return (global_option_set (ci->key, ci->values[0].value.string));
-	else if (ci->values[0].type == OCONFIG_TYPE_NUMBER)
-	{
-		char tmp[128];
-		ssnprintf (tmp, sizeof (tmp), "%lf", ci->values[0].value.number);
-		return (global_option_set (ci->key, tmp));
+	char tmp[128];
+	char *value;
+
+	value = config_item_to_char(ci, tmp, sizeof (tmp));
+	if (value) {
+		return (global_option_set (ci->key, value));
 	}
-	else if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN)
-	{
-		if (ci->values[0].value.boolean)
-			return (global_option_set (ci->key, "true"));
-		else
-			return (global_option_set (ci->key, "false"));
+	else {
+		return (-1);
 	}
-
-	return (-1);
 } /* int dispatch_global_option */
 
 static int dispatch_value_typesdb (const oconfig_item_t *ci)
@@ -230,7 +261,7 @@
 static int dispatch_value_plugindir (const oconfig_item_t *ci)
 {
 	assert (strcasecmp (ci->key, "PluginDir") == 0);
-	
+
 	if (ci->values_num != 1)
 		return (-1);
 	if (ci->values[0].type != OCONFIG_TYPE_STRING)
@@ -299,9 +330,42 @@
 	/* skip the initial space */
 	buffer_ptr = buffer + 1;
 
+	/* check if this is a plugin_global value */
+	for (i = 0; i < cf_plugin_global_options_num; i++)
+		if (strcasecmp (cf_plugin_global_options[i].key, ci->key) == 0)
+			return plugin_global_option_set (plugin, ci->key, buffer_ptr);
+
+        /* no plugin_global, pass to plugin config callback */
 	return (cf_dispatch (plugin, ci->key, buffer_ptr));
 } /* int dispatch_value_plugin */
 
+static int dispatch_plugin_global_value (const char *plugin, const oconfig_item_t *ci)
+{
+	int i;
+	char tmp[128];
+	char *value;
+
+        /* check if this is a simple value */
+        if (ci->children != NULL)
+        	return (0);
+
+	/* check if this is a plugin_global value */
+	for (i = 0; i < cf_plugin_global_options_num; i++)
+		if (strcasecmp (cf_plugin_global_options[i].key, ci->key) == 0)
+			break;
+	if (i >= cf_plugin_global_options_num)
+        	return (0);
+
+        /* store the value */
+	value = config_item_to_char(ci, tmp, sizeof (tmp));
+	if (value) {
+		return (plugin_global_option_set (plugin, ci->key, value));
+	}
+	else {
+		return (-1);
+	}
+} /* int dispatch_plugin_global_value */
+
 static int dispatch_value (const oconfig_item_t *ci)
 {
 	int ret = -2;
@@ -342,8 +406,14 @@
 
 	/* Check for a complex callback first */
 	for (cb = complex_callback_head; cb != NULL; cb = cb->next)
-		if (strcasecmp (name, cb->type) == 0)
+		if (strcasecmp (name, cb->type) == 0) {
+			/* Store plugin_global values */
+			for (i = 0; i < ci->children_num; i++)
+			{
+				dispatch_plugin_global_value (name, ci->children + i);
+			}
 			return (cb->callback (ci));
+		}
 
 	/* Hm, no complex plugin found. Dispatch the values one by one */
 	for (i = 0; i < ci->children_num; i++)
@@ -643,7 +713,7 @@
 	return (root);
 } /* oconfig_item_t *cf_read_dir */
 
-/* 
+/*
  * cf_read_generic
  *
  * Path is stat'ed and either cf_read_file or cf_read_dir is called
@@ -768,7 +838,7 @@
 } /* oconfig_item_t *cf_read_generic */
 #endif /* !HAVE_WORDEXP_H */
 
-/* 
+/*
  * Public functions
  */
 int global_option_set (const char *option, const char *value)
@@ -792,7 +862,7 @@
 		cf_global_options[i].value = NULL;
 
 	return (0);
-}
+} /* int global_option_set */
 
 const char *global_option_get (const char *option)
 {
@@ -804,12 +874,65 @@
 
 	if (i >= cf_global_options_num)
 		return (NULL);
-	
+
 	return ((cf_global_options[i].value != NULL)
 			? cf_global_options[i].value
 			: cf_global_options[i].def);
 } /* char *global_option_get */
 
+int plugin_global_option_set (const char *plugin, const char *option, const char *value)
+{
+	int i;
+	cf_plugin_global_value_t *v;
+
+	DEBUG ("plugin_global_option_set: plugin = %s; option = %s; value = %s;", plugin, option, value);
+
+	for (i = 0; i < cf_plugin_global_options_num; i++)
+		if (strcasecmp (cf_plugin_global_options[i].key, option) == 0)
+			break;
+
+	if (i >= cf_plugin_global_options_num)
+		return (-1);
+
+	for (v = cf_plugin_global_options[i].values; v; v = v->next)
+		if (strcasecmp (v->plugin, plugin) == 0)
+			break;
+	if (v) {
+		sfree (v->value);
+		v->value = strdup (value);
+	}
+	else {
+		if ((v = (cf_plugin_global_value_t *) malloc (sizeof (cf_plugin_global_value_t))) == NULL) {
+			ERROR ("Malloc failed in plugin_global_option_set");
+			return (0);
+		}
+		v->plugin = strdup (plugin);
+		v->value = strdup (value);
+		v->next = cf_plugin_global_options[i].values;
+		cf_plugin_global_options[i].values = v;
+	}
+	return (0);
+} /* int plugin_global_option_set */
+
+const char *plugin_global_option_get (const char *plugin, const char *option)
+{
+	int i;
+	cf_plugin_global_value_t *v;
+
+	for (i = 0; i < cf_plugin_global_options_num; i++)
+		if (strcasecmp (cf_plugin_global_options[i].key, option) == 0)
+			break;
+
+	if (i >= cf_plugin_global_options_num)
+		return (NULL);
+
+	for (v = cf_plugin_global_options[i].values; v; v = v->next)
+		if (strcasecmp (v->plugin, plugin) == 0)
+			break;
+
+	return (v ? v->value : NULL);
+} /* char *plugin_global_option_get */
+
 void cf_unregister (const char *type)
 {
 	cf_callback_t *this, *prev;
diff -ur src.orig/configfile.h src/configfile.h
--- src.orig/configfile.h	2010-07-09 12:02:00.000000000 +0200
+++ src/configfile.h	2011-02-18 11:37:22.178224000 +0100
@@ -28,7 +28,7 @@
 /*
  * DESCRIPTION
  *  Remove a registered plugin from the internal data structures.
- * 
+ *
  * PARAMETERS
  *  `type'      Name of the plugin (must be the same as passed to
  *              `plugin_register'
@@ -86,6 +86,9 @@
 int global_option_set (const char *option, const char *value);
 const char *global_option_get (const char *option);
 
+int plugin_global_option_set (const char *plugin, const char *option, const char *value);
+const char *plugin_global_option_get (const char *plugin, const char *option);
+
 /* Assures the config option is a string, duplicates it and returns the copy in
  * "ret_string". If necessary "*ret_string" is freed first. Returns zero upon
  * success. */
Only in src: config.h
Only in src: conntrack.la
Only in src: conntrack.lo
Only in src: conntrack.o
Only in src: contextswitch.la
Only in src: contextswitch.lo
Only in src: contextswitch.o
Only in src: cpufreq.la
Only in src: cpufreq.lo
Only in src: cpufreq.o
Only in src: cpu.la
Only in src: cpu_la-cpu.lo
Only in src: cpu_la-cpu.o
Only in src: csv.la
Only in src: csv.lo
Only in src: csv.o
Only in src: .deps
Only in src: df.la
Only in src: df.lo
Only in src: df.o
Only in src: disk.la
Only in src: disk_la-disk.lo
Only in src: disk_la-disk.o
Only in src: email.la
Only in src: email.lo
Only in src: email.o
Only in src: entropy.la
Only in src: entropy.lo
Only in src: entropy.o
Only in src: exec.la
Only in src: exec.lo
Only in src: exec.o
Only in src: filecount.la
Only in src: filecount.lo
Only in src: filecount.o
Only in src: fscache.la
Only in src: fscache.lo
Only in src: fscache.o
Only in src: hddtemp.la
Only in src: hddtemp.lo
Only in src: hddtemp.o
Only in src: interface.la
Only in src: interface_la-interface.lo
Only in src: interface_la-interface.o
Only in src: iptables.la
Only in src: iptables_la-iptables.lo
Only in src: iptables_la-iptables.o
Only in src: ipvs.la
Only in src: ipvs_la-ipvs.lo
Only in src: ipvs_la-ipvs.o
Only in src: irq.la
Only in src: irq.lo
Only in src: irq.o
Only in src/libcollectdclient: client.lo
Only in src/libcollectdclient: client.o
Only in src/libcollectdclient: libcollectdclient.la
Only in src/libcollectdclient: libcollectdclient.pc
Only in src/libcollectdclient: .libs
Only in src/libcollectdclient: Makefile
Only in src/liboconfig: liboconfig.la
Only in src/liboconfig: .libs
Only in src/liboconfig: Makefile
Only in src/liboconfig: oconfig.lo
Only in src/liboconfig: oconfig.o
Only in src/liboconfig: parser.lo
Only in src/liboconfig: parser.o
Only in src/liboconfig: scanner.lo
Only in src/liboconfig: scanner.o
Only in src: .libs
Only in src: load.la
Only in src: load_la-load.lo
Only in src: load_la-load.o
Only in src: logfile.la
Only in src: logfile.lo
Only in src: logfile.o
Only in src: madwifi.la
Only in src: madwifi.lo
Only in src: madwifi.o
Only in src: Makefile
Only in src: match_empty_counter.la
Only in src: match_empty_counter.lo
Only in src: match_empty_counter.o
Only in src: match_hashed.la
Only in src: match_hashed.lo
Only in src: match_hashed.o
Only in src: match_regex.la
Only in src: match_regex.lo
Only in src: match_regex.o
Only in src: match_timediff.la
Only in src: match_timediff.lo
Only in src: match_timediff.o
Only in src: match_value.la
Only in src: match_value.lo
Only in src: match_value.o
Only in src: mbmon.la
Only in src: mbmon.lo
Only in src: mbmon.o
Only in src: memcached.la
Only in src: memcached.lo
Only in src: memcached.o
Only in src: memory.la
Only in src: memory_la-memory.lo
Only in src: memory_la-memory.o
Only in src: multimeter.la
Only in src: multimeter.lo
Only in src: multimeter.o
Only in src: network.la
Only in src: network_la-network.lo
Only in src: network_la-network.o
Only in src: network_la-utils_fbhash.lo
Only in src: network_la-utils_fbhash.o
Only in src: nfs.la
Only in src: nfs.lo
Only in src: nfs.o
Only in src: ntpd.la
Only in src: ntpd.lo
Only in src: ntpd.o
Only in src: olsrd.la
Only in src: olsrd.lo
Only in src: olsrd.o
Only in src: openvpn.la
Only in src: openvpn_la-openvpn.lo
Only in src: openvpn_la-openvpn.o
Only in src/owniptc: libip4tc.lo
Only in src/owniptc: libip4tc.o
Only in src/owniptc: libip6tc.lo
Only in src/owniptc: libip6tc.o
Only in src/owniptc: libiptc.la
Only in src/owniptc: .libs
Only in src/owniptc: Makefile
Only in src: perl.la
Only in src: perl_la-perl.lo
Only in src: perl_la-perl.o
diff -ur src.orig/plugin.c src/plugin.c
--- src.orig/plugin.c	2010-07-09 12:02:00.000000000 +0200
+++ src/plugin.c	2011-02-21 13:56:49.457622000 +0100
@@ -324,6 +324,26 @@
 	return (0);
 }
 
+static void get_plugin_interval(const char *plugin, int *interval, int printError)
+{
+	/* check if there is a plugin specifig interval */
+	const char *str = plugin_global_option_get (plugin, "Interval");
+	if (str != NULL) {
+		int i = atoi (str);
+		if (i > 0) {
+			*interval = i;
+			return;
+		}
+		if (printError) {
+			ERROR ("Unable to convert value `Interval' for plugin `%s': %s\n"
+				"  unsing global `Interval'", plugin, str);
+		}
+	}
+
+	/* use the global interval */
+	*interval = interval_g;
+}
+
 static _Bool timeout_reached(struct timespec timeout)
 {
 	struct timeval now;
@@ -361,15 +381,18 @@
 
 		if ((rf->rf_interval.tv_sec == 0) && (rf->rf_interval.tv_nsec == 0))
 		{
-			gettimeofday (&now, /* timezone = */ NULL);
-
-			rf->rf_interval.tv_sec = interval_g;
+			int interval;
+			get_plugin_interval(rf->rf_name, &interval, 1);
+			rf->rf_interval.tv_sec = interval;
 			rf->rf_interval.tv_nsec = 0;
 
 			rf->rf_effective_interval = rf->rf_interval;
 
+			gettimeofday (&now, /* timezone = */ NULL);
 			rf->rf_next_read.tv_sec = now.tv_sec;
 			rf->rf_next_read.tv_nsec = 1000 * now.tv_usec;
+
+			INFO( "Interval for plugin `%s' set to %ds", rf->rf_name, interval);
 		}
 
 		/* sleep until this entry is due,
@@ -1382,7 +1405,7 @@
 		vl->time = time (NULL);
 
 	if (vl->interval <= 0)
-		vl->interval = interval_g;
+		get_plugin_interval(vl->plugin, &vl->interval, 0);
 
 	DEBUG ("plugin_dispatch_values: time = %u; interval = %i; "
 			"host = %s; "
Only in src: powerdns.la
Only in src: powerdns.lo
Only in src: powerdns.o
Only in src: processes.la
Only in src: processes.lo
Only in src: processes.o
Only in src: protocols.la
Only in src: protocols.lo
Only in src: protocols.o
Only in src: serial.la
Only in src: serial.lo
Only in src: serial.o
Only in src: stamp-h1
Only in src: swap.la
Only in src: swap_la-swap.lo
Only in src: swap_la-swap.o
Only in src: syslog.la
Only in src: syslog.lo
Only in src: syslog.o
Only in src: table.la
Only in src: table.lo
Only in src: table.o
Only in src: tail.la
Only in src: tail.lo
Only in src: tail.o
Only in src: target_notification.la
Only in src: target_notification.lo
Only in src: target_notification.o
Only in src: target_replace.la
Only in src: target_replace.lo
Only in src: target_replace.o
Only in src: target_scale.la
Only in src: target_scale.lo
Only in src: target_scale.o
Only in src: target_set.la
Only in src: target_set.lo
Only in src: target_set.o
Only in src: tcpconns.la
Only in src: tcpconns.lo
Only in src: tcpconns.o
Only in src: teamspeak2.la
Only in src: teamspeak2.lo
Only in src: teamspeak2.o
Only in src: ted.la
Only in src: ted.lo
Only in src: ted.o
Only in src: thermal.la
Only in src: thermal.lo
Only in src: thermal.o
Only in src: unixsock.la
Only in src: unixsock.lo
Only in src: unixsock.o
Only in src: uptime.la
Only in src: uptime_la-uptime.lo
Only in src: uptime_la-uptime.o
Only in src: users.la
Only in src: users_la-users.lo
Only in src: users_la-users.o
Only in src: utils_cmd_flush.lo
Only in src: utils_cmd_flush.o
Only in src: utils_cmd_getthreshold.lo
Only in src: utils_cmd_getthreshold.o
Only in src: utils_cmd_getval.lo
Only in src: utils_cmd_getval.o
Only in src: utils_cmd_listval.lo
Only in src: utils_cmd_listval.o
Only in src: utils_cmd_putnotif.lo
Only in src: utils_cmd_putnotif.o
Only in src: utils_cmd_putval.lo
Only in src: utils_cmd_putval.o
Only in src: utils_mount.lo
Only in src: utils_mount.o
Only in src: uuid.la
Only in src: uuid_la-uuid.lo
Only in src: uuid_la-uuid.o
Only in src: vmem.la
Only in src: vmem.lo
Only in src: vmem.o
Only in src: vserver.la
Only in src: vserver.lo
Only in src: vserver.o
Only in src: wireless.la
Only in src: wireless.lo
Only in src: wireless.o
