summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b309ea)
raw | patch | inline | side by side (parent: 0b309ea)
author | Florian Forster <octo@huhu.verplant.org> | |
Thu, 29 Mar 2007 17:21:14 +0000 (19:21 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Thu, 29 Mar 2007 17:21:14 +0000 (19:21 +0200) |
41 files changed:
diff --git a/src/apache.c b/src/apache.c
index 887977e423b4205cbae54542aa089be2934905e0..4184247cbe89150fe87496dfc24bb9fca69f19a9 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
} /* int apache_read */
#endif /* APACHE_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&apache_bytes_ds);
- plugin_register_data_set (&apache_requests_ds);
- plugin_register_data_set (&apache_scoreboard_ds);
- plugin_register_data_set (&apache_connections_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&apache_bytes_ds);
+ plugin_register_data_set (&apache_requests_ds);
+ plugin_register_data_set (&apache_scoreboard_ds);
+ plugin_register_data_set (&apache_connections_ds);
+ }
#if APACHE_HAVE_READ
- plugin_register_config ("apache", config,
- config_keys, config_keys_num);
- plugin_register_init ("apache", init);
- plugin_register_read ("apache", apache_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("apache", config,
+ config_keys, config_keys_num);
+ plugin_register_init ("apache", init);
+ plugin_register_read ("apache", apache_read);
+ }
#endif
-}
+} /* void module_register */
diff --git a/src/apcups.c b/src/apcups.c
index fc94e7d778b4b16e9689284afe62d5be0fec7ca1..2539c32f5c308972c953f965fb2daf00ca60c628 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
return (0);
} /* apcups_read */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds_voltage);
- plugin_register_data_set (&ds_percent);
- plugin_register_data_set (&ds_timeleft);
- plugin_register_data_set (&ds_temperature);
- plugin_register_data_set (&ds_frequency);
-
- plugin_register_config ("apcups", apcups_config, config_keys, config_keys_num);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&ds_voltage);
+ plugin_register_data_set (&ds_percent);
+ plugin_register_data_set (&ds_timeleft);
+ plugin_register_data_set (&ds_temperature);
+ plugin_register_data_set (&ds_frequency);
+ }
- plugin_register_read ("apcups", apcups_read);
- plugin_register_shutdown ("apcups", apcups_shutdown);
-}
+ if (load & MR_READ)
+ {
+ plugin_register_config ("apcups", apcups_config, config_keys,
+ config_keys_num);
+ plugin_register_read ("apcups", apcups_read);
+ plugin_register_shutdown ("apcups", apcups_shutdown);
+ }
+} /* void module_register */
diff --git a/src/apple_sensors.c b/src/apple_sensors.c
index f994b3194f373346baa2e1af6cff798d764ccd41..6b3cfc5e0bd13a926bd8465773b90058a56b0cf8 100644 (file)
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
} /* int as_read */
#endif /* IOKIT_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&fanspeed_ds);
- plugin_register_data_set (&temperature_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&fanspeed_ds);
+ plugin_register_data_set (&temperature_ds);
+ }
#if IOKIT_HAVE_READ
- plugin_register_init ("apple_sensors", as_init);
- plugin_register_read ("apple_sensors", as_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("apple_sensors", as_init);
+ plugin_register_read ("apple_sensors", as_read);
+ }
#endif /* IOKIT_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/battery.c b/src/battery.c
index 53442ce6dc049a2145cb53a81460c3e63e934361..bdf461945c7e780be1ed0e7d383054b0c046c7c6 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
}
#endif /* BATTERY_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&charge_ds);
- plugin_register_data_set (¤t_ds);
- plugin_register_data_set (&voltage_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&charge_ds);
+ plugin_register_data_set (¤t_ds);
+ plugin_register_data_set (&voltage_ds);
+ }
#if BATTERY_HAVE_READ
- plugin_register_init ("battery", battery_init);
- plugin_register_read ("battery", battery_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("battery", battery_init);
+ plugin_register_read ("battery", battery_read);
+ }
#endif /* BATTERY_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/configfile.c b/src/configfile.c
index 1d3b8954b546030e1bec7c574db455380486518f..311ebb385f0c7602af02b5102f1cd0ce8126e17e 100644 (file)
--- a/src/configfile.c
+++ b/src/configfile.c
* Prototypes of callback functions
*/
static int dispatch_value_plugindir (const oconfig_item_t *ci);
+static int dispatch_value_loadds (const oconfig_item_t *ci);
static int dispatch_value_loadplugin (const oconfig_item_t *ci);
/*
static cf_value_map_t cf_value_map[] =
{
{"PluginDir", dispatch_value_plugindir},
- {"LoadPlugin", dispatch_value_loadplugin}
+ {"LoadPlugin", dispatch_value_loadplugin},
+ {"LoadDS", dispatch_value_loadds}
};
static int cf_value_map_num = STATIC_ARRAY_LEN (cf_value_map);
return (0);
}
+static int dispatch_value_loadds (const oconfig_item_t *ci)
+{
+ assert (strcasecmp (ci->key, "LoadDS") == 0);
+
+ if (ci->values_num != 1)
+ return (-1);
+ if (ci->values[0].type != OCONFIG_TYPE_STRING)
+ return (-1);
+
+ return (plugin_load (ci->values[0].value.string, MR_DATASETS));
+} /* int dispatch_value_loadds */
+
static int dispatch_value_loadplugin (const oconfig_item_t *ci)
{
assert (strcasecmp (ci->key, "LoadPlugin") == 0);
if (ci->values[0].type != OCONFIG_TYPE_STRING)
return (-1);
- return (plugin_load (ci->values[0].value.string));
+ return (plugin_load (ci->values[0].value.string, MR_EVERYTHING));
} /* int dispatch_value_loadplugin */
static int dispatch_value_plugin (const char *plugin, oconfig_item_t *ci)
diff --git a/src/cpu.c b/src/cpu.c
index 1dcbdcd2b39b0d323aba0cdf4ea212bc117cc4bf..1dc78657ad2fe4e01b8fdfaaf3cb2ee06e75d310 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
}
#endif /* CPU_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds);
#if CPU_HAVE_READ
- plugin_register_init ("cpu", init);
- plugin_register_read ("cpu", cpu_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("cpu", init);
+ plugin_register_read ("cpu", cpu_read);
+ }
#endif /* CPU_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 5ceaacc8601ed92c20d3cc3f5501752d33caba83..e4caf5ffb4015da1bc1a0c98b26d4eca16b2e88c 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
#endif /* CPUFREQ_HAVE_READ */
#undef BUFSIZE
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&data_set);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&data_set);
#if CPUFREQ_HAVE_READ
- plugin_register_init ("cpufreq", cpufreq_init);
- plugin_register_read ("cpufreq", cpufreq_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("cpufreq", cpufreq_init);
+ plugin_register_read ("cpufreq", cpufreq_read);
+ }
#endif /* CPUFREQ_HAVE_READ */
}
diff --git a/src/csv.c b/src/csv.c
index 4379fe5fe4e4171b3b664406fb55d3be1c0aabb6..e67a9ca9139d74ec249410f30a8dc6c010661b57 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
return (0);
} /* int csv_write */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_config ("csv", csv_config,
- config_keys, config_keys_num);
- plugin_register_write ("csv", csv_write);
-}
+ if (load & MR_WRITE)
+ {
+ plugin_register_config ("csv", csv_config,
+ config_keys, config_keys_num);
+ plugin_register_write ("csv", csv_write);
+ }
+} /* void module_register */
diff --git a/src/df.c b/src/df.c
index 48d58c3fe315197469035cb0ee8f87fbd68c3a21..afd3e0b1334ae1219f36ab6e7d3cc65db87c0d52 100644 (file)
--- a/src/df.c
+++ b/src/df.c
} /* int df_read */
#endif /* DF_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds);
#if DF_HAVE_READ
- plugin_register_config ("df", df_config, config_keys, config_keys_num);
- plugin_register_init ("df", df_init);
- plugin_register_read ("df", df_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("df", df_config,
+ config_keys, config_keys_num);
+ plugin_register_init ("df", df_init);
+ plugin_register_read ("df", df_read);
+ }
#endif
} /* void module_register */
diff --git a/src/disk.c b/src/disk.c
index 2a5b713beeff3dc84ab25f7a2c91e8f85c6acf34..c9d2f36415c0af96a62d1f7da53e60855f6069eb 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
} /* int disk_read */
#endif /* DISK_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&octets_ds);
- plugin_register_data_set (&operations_ds);
- plugin_register_data_set (&merged_ds);
- plugin_register_data_set (&time_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&octets_ds);
+ plugin_register_data_set (&operations_ds);
+ plugin_register_data_set (&merged_ds);
+ plugin_register_data_set (&time_ds);
+ }
#if DISK_HAVE_READ
- plugin_register_init ("disk", disk_init);
- plugin_register_read ("disk", disk_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("disk", disk_init);
+ plugin_register_read ("disk", disk_read);
+ }
#endif /* DISK_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/dns.c b/src/dns.c
index 473003a74af301355c9947353344a59c564c6042..c9beb166e8f0a6f09c076cd554d244ad031808d6 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
} /* int dns_read */
#endif
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&octets_ds);
- plugin_register_data_set (&qtype_ds);
- plugin_register_data_set (&opcode_ds);
- plugin_register_data_set (&rcode_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&octets_ds);
+ plugin_register_data_set (&qtype_ds);
+ plugin_register_data_set (&opcode_ds);
+ plugin_register_data_set (&rcode_ds);
+ }
#if DNS_HAVE_READ
- plugin_register_config ("dns", dns_config, config_keys, config_keys_num);
- plugin_register_init ("dns", dns_init);
- plugin_register_read ("dns", dns_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("dns", dns_config, config_keys, config_keys_num);
+ plugin_register_init ("dns", dns_init);
+ plugin_register_read ("dns", dns_read);
+ }
#endif
} /* void module_register */
diff --git a/src/email.c b/src/email.c
index c8c3982b7a4836be5491ac3196954fa6a4986f44..ed58819384c0d8d4957f2c46a7485c4ec19a6188 100644 (file)
--- a/src/email.c
+++ b/src/email.c
return (0);
} /* int email_read */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&email_count_ds);
- plugin_register_data_set (&email_size_ds);
- plugin_register_data_set (&spam_check_ds);
- plugin_register_data_set (&spam_score_ds);
-
- plugin_register_config ("email", email_config, config_keys, config_keys_num);
- plugin_register_init ("email", email_init);
- plugin_register_read ("email", email_read);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&email_count_ds);
+ plugin_register_data_set (&email_size_ds);
+ plugin_register_data_set (&spam_check_ds);
+ plugin_register_data_set (&spam_score_ds);
+ }
+
+ if (load & MR_READ)
+ {
+ plugin_register_config ("email", email_config, config_keys, config_keys_num);
+ plugin_register_init ("email", email_init);
+ plugin_register_read ("email", email_read);
+ }
plugin_register_shutdown ("email", email_shutdown);
-} /* void module_register (void) */
+} /* void module_register */
/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
-
diff --git a/src/entropy.c b/src/entropy.c
index 68c57daf1220b48682185be6490f42d37fd4580f..fd48c74292561b3c264edd62f1392eb86621f152 100644 (file)
--- a/src/entropy.c
+++ b/src/entropy.c
}
#endif /* ENTROPY_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds);
+
#if ENTROPY_HAVE_READ
- plugin_register_read ("entropy", entropy_read);
+ if (load & MR_READ)
+ plugin_register_read ("entropy", entropy_read);
#endif
-}
+} /* void module_register */
diff --git a/src/exec.c b/src/exec.c
index c7c72029e278d686511c378f2f774b8462fd01b1..82c7efa655a94835178bd9592307d3a1362dc474 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
return (0);
} /* int exec_read */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds_counter);
- plugin_register_data_set (&ds_gauge);
- plugin_register_config ("exec", exec_config, config_keys, config_keys_num);
- plugin_register_read ("exec", exec_read);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&ds_counter);
+ plugin_register_data_set (&ds_gauge);
+ }
+
+ if (load & MR_READ)
+ {
+ plugin_register_config ("exec", exec_config, config_keys, config_keys_num);
+ plugin_register_read ("exec", exec_read);
+ }
} /* void module_register */
/*
diff --git a/src/hddtemp.c b/src/hddtemp.c
index a7758613336ce69a44feba077d4c9940d47cca5d..505d10f5bf9c389e024c1d3388ea815e1733c530 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
/* module_register
Register collectd plugin. */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&temperature_ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&temperature_ds);
#if HDDTEMP_HAVE_READ
- plugin_register_config ("hddtemp", hddtemp_config,
- config_keys, config_keys_num);
- plugin_register_init ("hddtemp", hddtemp_init);
- plugin_register_read ("hddtemp", hddtemp_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("hddtemp", hddtemp_config,
+ config_keys, config_keys_num);
+ plugin_register_init ("hddtemp", hddtemp_init);
+ plugin_register_read ("hddtemp", hddtemp_read);
+ }
#endif /* HDDTEMP_HAVE_READ */
}
diff --git a/src/interface.c b/src/interface.c
index 308c48ffed46d21675391a295528e91cb539a890..960cc6220933c78c635cdf185c39a65b8a5d5843 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
} /* int interface_read */
#endif /* INTERFACE_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&octets_ds);
- plugin_register_data_set (&packets_ds);
- plugin_register_data_set (&errors_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&octets_ds);
+ plugin_register_data_set (&packets_ds);
+ plugin_register_data_set (&errors_ds);
+ }
plugin_register_config ("interface", interface_config,
config_keys, config_keys_num);
+ if (load & MR_READ)
+ {
#if HAVE_LIBKSTAT
- plugin_register_init ("interface", interface_init);
+ plugin_register_init ("interface", interface_init);
#endif
-
#if INTERFACE_HAVE_READ
- plugin_register_read ("interface", interface_read);
+ plugin_register_read ("interface", interface_read);
#endif
-}
+ }
+} /* void module_register */
diff --git a/src/iptables.c b/src/iptables.c
index 47f0e550ce70e8dac757d18df52ccfe5cc2ba96b..1df35fa04d940b2f24e48625c3afc04ba7d0f51f 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
} /* int iptables_shutdown */
#endif /* IPTABLES_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ipt_bytes_ds);
- plugin_register_data_set (&ipt_packets_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&ipt_bytes_ds);
+ plugin_register_data_set (&ipt_packets_ds);
+ }
#if IPTABLES_HAVE_READ
- plugin_register_config ("iptables", iptables_config,
- config_keys, config_keys_num);
- plugin_register_read ("iptables", iptables_read);
- plugin_register_shutdown ("iptables", iptables_shutdown);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("iptables", iptables_config,
+ config_keys, config_keys_num);
+ plugin_register_read ("iptables", iptables_read);
+ plugin_register_shutdown ("iptables", iptables_shutdown);
+ }
#endif
-}
+} /* void module_register */
#undef BUFSIZE
#undef MODULE_NAME
diff --git a/src/irq.c b/src/irq.c
index e39d0a5721d3bbdef2cbd4e6a9eafcc9d6c05ce9..3df9d869ee92ba9abbcf9bc9839e01c18456eaad 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
#include "plugin.h"
#include "configfile.h"
-#define MODULE_NAME "irq"
-
#if KERNEL_LINUX
# define IRQ_HAVE_READ 1
#else
} /* int irq_read */
#endif /* IRQ_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds_irq);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds_irq);
#if IRQ_HAVE_READ
- plugin_register_config ("irq", irq_config,
- config_keys, config_keys_num);
- plugin_register_read ("irq", irq_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("irq", irq_config,
+ config_keys, config_keys_num);
+ plugin_register_read ("irq", irq_read);
+ }
#endif /* IRQ_HAVE_READ */
-}
+} /* void module_register */
#undef BUFSIZE
-#undef MODULE_NAME
diff --git a/src/load.c b/src/load.c
index b92e54f53b60380b77df26f7e1225a571f36c4d3..7be594d15f26bd8b9a7de2c08f9b93b12716eff1 100644 (file)
--- a/src/load.c
+++ b/src/load.c
#include "common.h"
#include "plugin.h"
-#define MODULE_NAME "load"
-
#if defined(HAVE_GETLOADAVG) || defined(KERNEL_LINUX) || defined(HAVE_LIBSTATGRAB)
# define LOAD_HAVE_READ 1
#else
}
#endif /* LOAD_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds);
+
#if LOAD_HAVE_READ
- plugin_register_read ("load", load_read);
+ if (load & MR_READ)
+ plugin_register_read ("load", load_read);
#endif
-}
-
-#undef MODULE_NAME
+} /* void module_register */
diff --git a/src/logfile.c b/src/logfile.c
index 4563c8924157612e0864e4928d60ad8fe5d9fb87..5cb409141fbf37158085cd15ef210ee52c4b1b13 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
return;
} /* void logfile_log (int, const char *) */
-void module_register (void)
+void module_register (modreg_e load)
{
plugin_register_config ("logfile", logfile_config,
config_keys, config_keys_num);
plugin_register_log ("logfile", logfile_log);
- return;
} /* void module_register (void) */
/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
diff --git a/src/mbmon.c b/src/mbmon.c
index fcb4cc747d6ca5dc168fb5b39afe465acd6041c6..08c49fe3096bd0849f040cb2e82a8cb17303264e 100644 (file)
--- a/src/mbmon.c
+++ b/src/mbmon.c
/* module_register
Register collectd plugin. */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&fanspeed_ds);
- plugin_register_data_set (&temperature_ds);
- plugin_register_data_set (&voltage_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&fanspeed_ds);
+ plugin_register_data_set (&temperature_ds);
+ plugin_register_data_set (&voltage_ds);
+ }
#if MBMON_HAVE_READ
- plugin_register_config ("mbmon", mbmon_config, config_keys, config_keys_num);
- plugin_register_read ("mbmon", mbmon_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("mbmon", mbmon_config, config_keys, config_keys_num);
+ plugin_register_read ("mbmon", mbmon_read);
+ }
#endif /* MBMON_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/memory.c b/src/memory.c
index 66bcefaee62dd48cd23ea5158ab586189da5d1cc..21877205467441fef10cb673125cc21d6aa9ae5a 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
}
#endif /* MEMORY_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds);
#if MEMORY_HAVE_READ
- plugin_register_init ("memory", memory_init);
- plugin_register_read ("memory", memory_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("memory", memory_init);
+ plugin_register_read ("memory", memory_read);
+ }
#endif /* MEMORY_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/multimeter.c b/src/multimeter.c
index d80c990cebffeaefa00aea2bc1e80008ff27c19e..02abfc8a9f8d33768577ac59257af6870cebc7d6 100644 (file)
--- a/src/multimeter.c
+++ b/src/multimeter.c
}
#endif /* MULTIMETER_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&data_set);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&data_set);
#if MULTIMETER_HAVE_READ
- plugin_register_init ("multimeter", multimeter_init);
- plugin_register_read ("multimeter", multimeter_read);
- plugin_register_shutdown ("multimeter", multimeter_shutdown);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("multimeter", multimeter_init);
+ plugin_register_read ("multimeter", multimeter_read);
+ plugin_register_shutdown ("multimeter", multimeter_shutdown);
+ }
#endif /* MULTIMETER_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/mysql.c b/src/mysql.c
index 92b49bff960e930f7abe0aed0ac0741028335280..5fbe5a662d02cb17b1f779a412e2fc52a9968320 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
} /* int mysql_read */
#endif /* MYSQL_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds_commands);
- plugin_register_data_set (&ds_handler);
- plugin_register_data_set (&ds_qcache);
- plugin_register_data_set (&ds_threads);
- plugin_register_data_set (&ds_octets);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&ds_commands);
+ plugin_register_data_set (&ds_handler);
+ plugin_register_data_set (&ds_qcache);
+ plugin_register_data_set (&ds_threads);
+ plugin_register_data_set (&ds_octets);
+ }
#if MYSQL_HAVE_READ
- plugin_register_config ("mysql", config, config_keys, config_keys_num);
- plugin_register_read ("mysql", mysql_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("mysql", config, config_keys, config_keys_num);
+ plugin_register_read ("mysql", mysql_read);
+ }
#endif /* MYSQL_HAVE_READ */
} /* void module_register */
diff --git a/src/network.c b/src/network.c
index 6d86c1d0dc8c0022272f5352480346066f5e12ce..4b50ce2db727b4ae48f8a4474811e491c9f8b339 100644 (file)
--- a/src/network.c
+++ b/src/network.c
return (0);
} /* int network_init */
-void module_register (void)
+void module_register (modreg_e load)
{
plugin_register_config ("network", network_config,
config_keys, config_keys_num);
plugin_register_init ("network", network_init);
-}
+} /* void module_register */
diff --git a/src/nfs.c b/src/nfs.c
index d54c838852e0dc9a6a6f0c7afebf4a8ae78ac19f..40e4110b54029e4e1b0a4d3279a0922c480bf9e8 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
#include "common.h"
#include "plugin.h"
-#define MODULE_NAME "nfs"
-
/* #if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) */
#if KERNEL_LINUX
# define NFS_HAVE_READ 1
}
#endif /* NFS_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&procedure_ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&procedure_ds);
#if NFS_HAVE_READ
- plugin_register_read ("nfs", nfs_read);
+ if (load & MR_READ)
+ plugin_register_read ("nfs", nfs_read);
#endif
-}
-
-#undef MODULE_NAME
+} /* void module_register */
diff --git a/src/ntpd.c b/src/ntpd.c
index dded360c68114a349533a4b41f41f5324d51fa8d..7f4d62a040b27cc297baa139fde4842197f78e04 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
} /* int ntpd_read */
#endif /* NTPD_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&time_offset_ds);
- plugin_register_data_set (&time_dispersion_ds);
- plugin_register_data_set (&delay_ds);
- plugin_register_data_set (&frequency_offset_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&time_offset_ds);
+ plugin_register_data_set (&time_dispersion_ds);
+ plugin_register_data_set (&delay_ds);
+ plugin_register_data_set (&frequency_offset_ds);
+ }
#if NTPD_HAVE_READ
- plugin_register_config ("ntpd", ntpd_config, config_keys, config_keys_num);
- plugin_register_read ("ntpd", ntpd_read);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("ntpd", ntpd_config,
+ config_keys, config_keys_num);
+ plugin_register_read ("ntpd", ntpd_read);
+ }
#endif /* NTPD_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/ping.c b/src/ping.c
index 7c30a25e51b5e7e0d554f77d2b6cf3542fc81d6d..6dcd9ec70d653f27dbea56cde12507c168560c54 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
return (0);
} /* int ping_read */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds);
- plugin_register_init ("ping", ping_init);
- plugin_register_read ("ping", ping_read);
- plugin_register_config ("ping", ping_config, config_keys, config_keys_num);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds);
+
+ if (load & MR_READ)
+ {
+ plugin_register_config ("ping", ping_config,
+ config_keys, config_keys_num);
+ plugin_register_init ("ping", ping_init);
+ plugin_register_read ("ping", ping_read);
+ }
} /* void module_register */
diff --git a/src/plugin.c b/src/plugin.c
index 86ffbde7bc395dd20d211a8b7711f3100f241257..c6762dec7103402e2c31b903642ea112c8dde09b 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
* object, but it will bitch about a shared object not having a
* ``module_register'' symbol..
*/
-static int plugin_load_file (char *file)
+static int plugin_load_file (char *file, modreg_e load)
{
lt_dlhandle dlh;
- void (*reg_handle) (void);
+ void (*reg_handle) (modreg_e mr);
DEBUG ("file = %s", file);
return (1);
}
- if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
+ if ((reg_handle = (void (*) (modreg_e)) lt_dlsym (dlh, "module_register")) == NULL)
{
WARNING ("Couldn't find symbol ``module_register'' in ``%s'': %s\n",
file, lt_dlerror ());
return (-1);
}
- (*reg_handle) ();
+ (*reg_handle) (load);
return (0);
}
}
#define BUFSIZE 512
-int plugin_load (const char *type)
+int plugin_load (const char *type, modreg_e mr)
{
DIR *dh;
const char *dir;
continue;
}
- if (plugin_load_file (filename) == 0)
+ if (plugin_load_file (filename, mr) == 0)
{
/* success */
ret = 0;
diff --git a/src/plugin.h b/src/plugin.h
index ba6cde284affa0115bede3cc0272ca2c32525be6..0164e9cf9a2d032bf5c5bf683c64db756047cda2 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
/*
* Public data types
*/
+enum modreg
+{
+ MR_EVERYTHING = 7,
+ MR_DATASETS = 1,
+ MR_READ = 2,
+ MR_WRITE = 4
+};
+typedef enum modreg modreg_e;
+
typedef unsigned long long counter_t;
typedef double gauge_t;
* functions.
*
* ARGUMENTS
- * `type' Name of the plugin to load.
+ * `name' Name of the plugin to load.
+ * `mr' Types of functions to request from the plugin.
*
* RETURN VALUE
* Returns zero upon success, a value greater than zero if no plugin was found
* NOTES
* No attempt is made to re-load an already loaded module.
*/
-int plugin_load (const char *name);
+int plugin_load (const char *name, modreg_e mr);
void plugin_init_all (void);
void plugin_read_all (const int *loop);
diff --git a/src/processes.c b/src/processes.c
index 5fd12212e4486f0302df6f435432017c2fdb625a..f57f2d3134bfb237da47f85b89eff544ad42a533 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
} /* int ps_read */
#endif /* PROCESSES_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&state_ds);
- plugin_register_data_set (&rss_ds);
- plugin_register_data_set (&time_ds);
- plugin_register_data_set (&count_ds );
- plugin_register_data_set (&pagefaults_ds );
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&state_ds);
+ plugin_register_data_set (&rss_ds);
+ plugin_register_data_set (&time_ds);
+ plugin_register_data_set (&count_ds);
+ plugin_register_data_set (&pagefaults_ds);
+ }
#if PROCESSES_HAVE_READ
+ if (load & MR_READ)
+ {
#if HAVE_THREAD_INFO | KERNEL_LINUX
- plugin_register_config ("processes", ps_config,
- config_keys, config_keys_num);
+ plugin_register_config ("processes", ps_config,
+ config_keys, config_keys_num);
#endif
- plugin_register_init ("processes", ps_init);
- plugin_register_read ("processes", ps_read);
+ plugin_register_init ("processes", ps_init);
+ plugin_register_read ("processes", ps_read);
+ }
#endif /* PROCESSES_HAVE_READ */
-}
-
+} /* void module_register */
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 6dc14c763d01dffa8434f82874cdda2da48058a4..b221341ca4925e002b099381cf960f1bf5d4eb58 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
return (0);
} /* int rrd_init */
-void module_register (void)
+void module_register (modreg_e load)
{
plugin_register_config ("rrdtool", rrd_config,
config_keys, config_keys_num);
diff --git a/src/sensors.c b/src/sensors.c
index 4b0fc3da2c695d67d0912c1b1b8d7d53097d175b..551d267ca2da0c5d4fdb00eda24b4da404393ca2 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
} /* int sensors_read */
#endif /* SENSORS_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&fanspeed_ds);
- plugin_register_data_set (&temperature_ds);
- plugin_register_data_set (&voltage_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&fanspeed_ds);
+ plugin_register_data_set (&temperature_ds);
+ plugin_register_data_set (&voltage_ds);
+ }
#if SENSORS_HAVE_READ
- plugin_register_config ("sensors", sensors_config,
- config_keys, config_keys_num);
- plugin_register_read ("sensors", sensors_read);
- plugin_register_shutdown ("sensors", sensors_shutdown);
+ if (load & MR_READ)
+ {
+ plugin_register_config ("sensors", sensors_config,
+ config_keys, config_keys_num);
+ plugin_register_read ("sensors", sensors_read);
+ plugin_register_shutdown ("sensors", sensors_shutdown);
+ }
#endif
} /* void module_register */
diff --git a/src/serial.c b/src/serial.c
index 9fb26df1ea2aee15febba70d6b2be08fe762b97f..c278672086b64d3b6b7474f96241f1975855a27d 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
} /* int serial_read */
#endif /* SERIAL_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&octets_ds);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&octets_ds);
#if SERIAL_HAVE_READ
- plugin_register_read ("serial", serial_read);
+ if (load & MR_READ)
+ plugin_register_read ("serial", serial_read);
#endif /* SERIAL_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/swap.c b/src/swap.c
index 6b0620cd296233a46ba169e67723eb7e2a8d1244..86bdc352d57b28ecc439d928f910df78b94f14d1 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
} /* int swap_read */
#endif /* SWAP_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&data_set);
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&data_set);
#if SWAP_HAVE_READ
- plugin_register_init ("swap", swap_init);
- plugin_register_read ("swap", swap_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("swap", swap_init);
+ plugin_register_read ("swap", swap_read);
+ }
#endif /* SWAP_HAVE_READ */
-}
+} /* void module_register */
diff --git a/src/syslog.c b/src/syslog.c
index 3123e89b4f8705d0f069e63f264b13b5d87c1d20..d643e39a4f195d4556ee170113ef1d4b56a5db93 100644 (file)
--- a/src/syslog.c
+++ b/src/syslog.c
return (0);
}
-void module_register (void)
+void module_register (modreg_e load)
{
plugin_register_config ("syslog", sl_config, config_keys, config_keys_num);
plugin_register_init ("syslog", sl_init);
plugin_register_log ("syslog", sl_log);
plugin_register_shutdown ("syslog", sl_shutdown);
-
- return;
} /* void module_register(void) */
diff --git a/src/tape.c b/src/tape.c
index 85a63a8965b14f6984c9b6874c918b3befe336b6..2345cb343e5d3e3590064496a3431a9a903ae1e3 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
}
#endif /* TAPE_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&octets_ds);
- plugin_register_data_set (&operations_ds);
- plugin_register_data_set (&merged_ds);
- plugin_register_data_set (&time_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&octets_ds);
+ plugin_register_data_set (&operations_ds);
+ plugin_register_data_set (&merged_ds);
+ plugin_register_data_set (&time_ds);
+ }
#if TAPE_HAVE_READ
- plugin_register_init ("tape", tape_init);
- plugin_register_read ("tape", tape_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("tape", tape_init);
+ plugin_register_read ("tape", tape_read);
+ }
#endif /* TAPE_HAVE_READ */
}
diff --git a/src/unixsock.c b/src/unixsock.c
index 75f3117e1e54136f2be78d2037df7c1d9316874a..aa5b67c05948c69bda1930234509bd02dc2a270c 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
return (0);
}
-void module_register (void)
+void module_register (modreg_e load)
{
plugin_register_config ("unixsock", us_config,
config_keys, config_keys_num);
diff --git a/src/users.c b/src/users.c
index 03d6148c04453e6855f5e4b892e230efa7dde5bc..e600aab3ae01e36b33b2946db50b58211a673f5c 100644 (file)
--- a/src/users.c
+++ b/src/users.c
} /* int users_read */
#endif /* USERS_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&ds);
- plugin_register_read ("users", users_read);
- return;
+ if (load & MR_DATASETS)
+ plugin_register_data_set (&ds);
+
+#if USERS_HAVE_READ
+ if (load & MR_READ)
+ plugin_register_read ("users", users_read);
+#endif
} /* void module_register(void) */
diff --git a/src/vserver.c b/src/vserver.c
index e4742e91af4ad75fcdb70e0dc1f1e93ce4c2c14c..2e3906097a1882bf1d0d1bc2acf910aed9534965 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
} /* int vserver_read */
#endif /* VSERVER_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&octets_ds);
- plugin_register_data_set (&load_ds);
- plugin_register_data_set (&threads_ds);
- plugin_register_data_set (&processes_ds);
- plugin_register_data_set (&memory_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&octets_ds);
+ plugin_register_data_set (&load_ds);
+ plugin_register_data_set (&threads_ds);
+ plugin_register_data_set (&processes_ds);
+ plugin_register_data_set (&memory_ds);
+ }
#if VSERVER_HAVE_READ
- plugin_register_init ("vserver", vserver_init);
- plugin_register_read ("vserver", vserver_read);
+ if (load & MR_READ)
+ {
+ plugin_register_init ("vserver", vserver_init);
+ plugin_register_read ("vserver", vserver_read);
+ }
#endif /* VSERVER_HAVE_READ */
} /* void module_register(void) */
diff --git a/src/wireless.c b/src/wireless.c
index 8ce7854c26a59696e0abf24edd544f342382dfee..007272e1ed28bd5bbf2cca0a831a1f6bbdea0d7a 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
} /* int wireless_read */
#endif /* WIRELESS_HAVE_READ */
-void module_register (void)
+void module_register (modreg_e load)
{
- plugin_register_data_set (&quality_ds);
- plugin_register_data_set (&power_ds);
- plugin_register_data_set (&noise_ds);
+ if (load & MR_DATASETS)
+ {
+ plugin_register_data_set (&quality_ds);
+ plugin_register_data_set (&power_ds);
+ plugin_register_data_set (&noise_ds);
+ }
#if WIRELESS_HAVE_READ
- plugin_register_read ("wireless", wireless_read);
+ if (load & MR_READ)
+ plugin_register_read ("wireless", wireless_read);
#endif /* WIRELESS_HAVE_READ */
-}
+} /* void module_register */