From: Florian Forster Date: Thu, 3 May 2007 16:31:49 +0000 (+0200) Subject: Removed the config-option `LoadDS' and the passing of the `modreg_e' enum to `module_... X-Git-Tag: collectd-4.0.0~57^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e1b0c447f57338706d45a485b40da7325faa4f34;p=collectd.git Removed the config-option `LoadDS' and the passing of the `modreg_e' enum to `module_register' again. --- diff --git a/src/apache.c b/src/apache.c index 4184247c..573a116a 100644 --- a/src/apache.c +++ b/src/apache.c @@ -34,49 +34,6 @@ # define APACHE_HAVE_READ 0 #endif -/* Limit to 2^27 bytes/s. That's what a gigabit-ethernet link can handle, in - * theory. */ -static data_source_t apache_bytes_dsrc[1] = -{ - {"count", DS_TYPE_COUNTER, 0, 134217728.0}, -}; - -static data_set_t apache_bytes_ds = -{ - "apache_bytes", 1, apache_bytes_dsrc -}; - -/* Limit to 2^20 requests/s */ -static data_source_t apache_requests_dsrc[1] = -{ - {"count", DS_TYPE_COUNTER, 0, 134217728.0}, -}; - -static data_set_t apache_requests_ds = -{ - "apache_requests", 1, apache_requests_dsrc -}; - -static data_source_t apache_scoreboard_dsrc[1] = -{ - {"count", DS_TYPE_GAUGE, 0, 65535.0}, -}; - -static data_set_t apache_scoreboard_ds = -{ - "apache_scoreboard", 1, apache_scoreboard_dsrc -}; - -static data_source_t apache_connections_dsrc[1] = -{ - {"count", DS_TYPE_GAUGE, 0, 65535.0}, -}; - -static data_set_t apache_connections_ds = -{ - "apache_connections", 1, apache_connections_dsrc -}; - #if APACHE_HAVE_READ static char *url = NULL; static char *user = NULL; @@ -354,23 +311,12 @@ static int apache_read (void) } /* int apache_read */ #endif /* APACHE_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - 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); - } + 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 2539c32f..75de03e8 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -78,59 +78,6 @@ static int conf_port = NISPORT; static int global_sockfd = -1; -/* - * The following are only if not compiled to test the module with its own main. -*/ -static data_source_t data_source_voltage[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t ds_voltage = -{ - "voltage", 1, data_source_voltage -}; - -static data_source_t data_source_percent[1] = -{ - {"percent", DS_TYPE_GAUGE, 0, 100.1} -}; - -static data_set_t ds_percent = -{ - "percent", 1, data_source_percent -}; - -static data_source_t data_source_timeleft[1] = -{ - {"timeleft", DS_TYPE_GAUGE, 0, 100.0} -}; - -static data_set_t ds_timeleft = -{ - "timeleft", 1, data_source_timeleft -}; - -static data_source_t data_source_temperature[1] = -{ - {"value", DS_TYPE_GAUGE, -273.15, NAN} -}; - -static data_set_t ds_temperature = -{ - "temperature", 1, data_source_temperature -}; - -static data_source_t data_source_frequency[1] = -{ - {"frequency", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t ds_frequency = -{ - "frequency", 1, data_source_frequency -}; - static const char *config_keys[] = { "Host", @@ -488,22 +435,10 @@ static int apcups_read (void) return (0); } /* apcups_read */ -void module_register (modreg_e load) +void module_register (void) { - 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); - } - - 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); - } + 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 6b3cfc5e..848c212a 100644 --- a/src/apple_sensors.c +++ b/src/apple_sensors.c @@ -59,26 +59,6 @@ static mach_port_t io_master_port = MACH_PORT_NULL; #endif -static data_source_t data_source_fanspeed[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t fanspeed_ds = -{ - "fanspeed", 1, data_source_fanspeed -}; - -static data_source_t data_source_temperature[1] = -{ - {"value", DS_TYPE_GAUGE, -273.15, NAN} -}; - -static data_set_t temperature_ds = -{ - "temperature", 1, data_source_temperature -}; - #if IOKIT_HAVE_READ static int as_init (void) { @@ -262,14 +242,8 @@ static int as_read (void) } /* int as_read */ #endif /* IOKIT_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - { - plugin_register_data_set (&fanspeed_ds); - plugin_register_data_set (&temperature_ds); - } - #if IOKIT_HAVE_READ if (load & MR_READ) { diff --git a/src/battery.c b/src/battery.c index bdf46194..952c56c0 100644 --- a/src/battery.c +++ b/src/battery.c @@ -56,36 +56,6 @@ #define INVALID_VALUE 47841.29 -static data_source_t data_source_charge[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t charge_ds = -{ - "charge", 1, data_source_charge -}; - -static data_source_t data_source_current[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t current_ds = -{ - "current", 1, data_source_current -}; - -static data_source_t data_source_voltage[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t voltage_ds = -{ - "voltage", 1, data_source_voltage -}; - #if BATTERY_HAVE_READ #if HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H /* No global variables */ @@ -555,20 +525,10 @@ static int battery_read (void) } #endif /* BATTERY_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - { - plugin_register_init ("battery", battery_init); - plugin_register_read ("battery", battery_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 45495c1a..a10314d0 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -59,7 +59,6 @@ typedef struct cf_global_option_s * 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); /* @@ -70,8 +69,7 @@ static cf_callback_t *first_callback = NULL; static cf_value_map_t cf_value_map[] = { {"PluginDir", dispatch_value_plugindir}, - {"LoadPlugin", dispatch_value_loadplugin}, - {"LoadDS", dispatch_value_loadds} + {"LoadPlugin", dispatch_value_loadplugin} }; static int cf_value_map_num = STATIC_ARRAY_LEN (cf_value_map); @@ -184,18 +182,6 @@ static int dispatch_value_plugindir (const oconfig_item_t *ci) 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); @@ -205,7 +191,7 @@ static int dispatch_value_loadplugin (const oconfig_item_t *ci) if (ci->values[0].type != OCONFIG_TYPE_STRING) return (-1); - return (plugin_load (ci->values[0].value.string, MR_EVERYTHING)); + return (plugin_load (ci->values[0].value.string)); } /* 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 d774ca4e..99e7a669 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -74,16 +74,6 @@ # define CPU_HAVE_READ 0 #endif -static data_source_t dsrc[1] = -{ - {"value", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t ds = -{ - "cpu", 1, dsrc -}; - #if CPU_HAVE_READ #ifdef PROCESSOR_CPU_LOAD_INFO static mach_port_t port_host; @@ -401,16 +391,10 @@ static int cpu_read (void) } #endif /* CPU_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&ds); - #if CPU_HAVE_READ - if (load & MR_READ) - { - plugin_register_init ("cpu", init); - plugin_register_read ("cpu", cpu_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 e4caf5ff..7a5c8fdf 100644 --- a/src/cpufreq.c +++ b/src/cpufreq.c @@ -32,16 +32,6 @@ # define CPUFREQ_HAVE_READ 0 #endif -static data_source_t data_source[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t data_set = -{ - "cpufreq", 1, data_source -}; - #if CPUFREQ_HAVE_READ #ifdef KERNEL_LINUX static int num_cpu = 0; @@ -155,16 +145,10 @@ static int cpufreq_read (void) #endif /* CPUFREQ_HAVE_READ */ #undef BUFSIZE -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&data_set); - #if CPUFREQ_HAVE_READ - if (load & MR_READ) - { - plugin_register_init ("cpufreq", cpufreq_init); - plugin_register_read ("cpufreq", cpufreq_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 5d64fb89..fcd707eb 100644 --- a/src/csv.c +++ b/src/csv.c @@ -265,12 +265,9 @@ static int csv_write (const data_set_t *ds, const value_list_t *vl) return (0); } /* int csv_write */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_WRITE) - { - plugin_register_config ("csv", csv_config, - config_keys, config_keys_num); - plugin_register_write ("csv", csv_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 afd3e0b1..433f4e2c 100644 --- a/src/df.c +++ b/src/df.c @@ -46,18 +46,6 @@ # define BLOCKSIZE(s) (s).f_bsize #endif -/* 2^50 - 1 == 1125899906842623 = 1 Petabyte */ -static data_source_t dsrc[2] = -{ - {"free", DS_TYPE_GAUGE, 0, 1125899906842623.0}, - {"used", DS_TYPE_GAUGE, 0, 1125899906842623.0} -}; - -static data_set_t ds = -{ - "df", 2, dsrc -}; - #if DF_HAVE_READ static const char *config_keys[] = { @@ -223,18 +211,12 @@ static int df_read (void) } /* int df_read */ #endif /* DF_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&ds); - #if DF_HAVE_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); - } + 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 77122706..31c3ec2e 100644 --- a/src/disk.c +++ b/src/disk.c @@ -57,52 +57,6 @@ # define DISK_HAVE_READ 0 #endif -/* 2^34 = 17179869184 = ~17.2GByte/s */ -static data_source_t octets_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 17179869183.0}, - {"write", DS_TYPE_COUNTER, 0, 17179869183.0} -}; - -static data_set_t octets_ds = -{ - "disk_octets", 2, octets_dsrc -}; - -static data_source_t operations_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"write", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t operations_ds = -{ - "disk_ops", 2, operations_dsrc -}; - -static data_source_t merged_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"write", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t merged_ds = -{ - "disk_merged", 2, merged_dsrc -}; - -/* max is 1000000us per second. */ -static data_source_t time_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 1000000.0}, - {"write", DS_TYPE_COUNTER, 0, 1000000.0} -}; - -static data_set_t time_ds = -{ - "disk_time", 2, time_dsrc -}; - #if DISK_HAVE_READ #if HAVE_IOKIT_IOKITLIB_H static mach_port_t io_master_port = MACH_PORT_NULL; @@ -611,21 +565,10 @@ static int disk_read (void) } /* int disk_read */ #endif /* DISK_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - { - plugin_register_init ("disk", disk_init); - plugin_register_read ("disk", disk_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 c9beb166..5af9c20c 100644 --- a/src/dns.c +++ b/src/dns.c @@ -50,37 +50,6 @@ typedef struct counter_list_s counter_list_t; /* * Private variables */ -static data_source_t octets_dsrc[2] = -{ - {"queries", DS_TYPE_COUNTER, 0, 125000000.0}, - {"responses", DS_TYPE_COUNTER, 0, 125000000.0} -}; - -static data_set_t octets_ds = -{ - "dns_octets", 2, octets_dsrc -}; - -static data_source_t counter_dsrc[1] = -{ - {"value", DS_TYPE_COUNTER, 0, 65535.0} -}; - -static data_set_t qtype_ds = -{ - "dns_qtype", 1, counter_dsrc -}; - -static data_set_t opcode_ds = -{ - "dns_opcode", 1, counter_dsrc -}; - -static data_set_t rcode_ds = -{ - "dns_rcode", 1, counter_dsrc -}; - #if DNS_HAVE_READ static const char *config_keys[] = { @@ -433,22 +402,11 @@ static int dns_read (void) } /* int dns_read */ #endif -void module_register (modreg_e load) +void module_register (void) { - 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 - 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); - } + 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 7738a39b..b4767554 100644 --- a/src/email.c +++ b/src/email.c @@ -137,36 +137,6 @@ static const char *config_keys[] = }; static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); -static data_source_t gauge_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, NAN} -}; - -static data_set_t email_count_ds = -{ - "email_count", 1, gauge_dsrc -}; - -static data_set_t email_size_ds = -{ - "email_size", 1, gauge_dsrc -}; - -static data_set_t spam_check_ds = -{ - "spam_check", 1, gauge_dsrc -}; - -static data_source_t spam_score_dsrc[1] = -{ - {"score", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t spam_score_ds = -{ - "spam_score", 1, spam_score_dsrc -}; - /* socket configuration */ static char *sock_group = COLLECTD_GRP_NAME; static int sock_perms = S_IRWXU | S_IRWXG; @@ -891,22 +861,11 @@ static int email_read (void) return (0); } /* int email_read */ -void module_register (modreg_e load) +void module_register (void) { - 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_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 */ diff --git a/src/entropy.c b/src/entropy.c index fd48c742..7e903953 100644 --- a/src/entropy.c +++ b/src/entropy.c @@ -31,16 +31,6 @@ #define ENTROPY_FILE "/proc/sys/kernel/random/entropy_avail" -static data_source_t dsrc[1] = -{ - {"entropy", DS_TYPE_GAUGE, 0.0, 4294967295.0} -}; - -static data_set_t ds = -{ - "entropy", 1, dsrc -}; - #if ENTROPY_HAVE_READ static void entropy_submit (double entropy) { @@ -88,13 +78,9 @@ static int entropy_read (void) } #endif /* ENTROPY_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&ds); - #if ENTROPY_HAVE_READ - if (load & MR_READ) - plugin_register_read ("entropy", entropy_read); + plugin_register_read ("entropy", entropy_read); #endif } /* void module_register */ diff --git a/src/exec.c b/src/exec.c index 5bddfc59..518efc87 100644 --- a/src/exec.c +++ b/src/exec.c @@ -45,26 +45,6 @@ struct program_list_s /* * Private variables */ -static data_source_t dsrc_counter[1] = -{ - {"value", DS_TYPE_COUNTER, NAN, NAN} -}; - -static data_set_t ds_counter = -{ - "counter", STATIC_ARRAY_SIZE (dsrc_counter), dsrc_counter -}; - -static data_source_t dsrc_gauge[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t ds_gauge = -{ - "gauge", STATIC_ARRAY_SIZE (dsrc_gauge), dsrc_gauge -}; - static const char *config_keys[] = { "Exec" @@ -384,20 +364,11 @@ static int exec_shutdown (void) return (0); } /* int exec_shutdown */ -void module_register (modreg_e load) +void module_register (void) { - 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); - plugin_register_shutdown ("exec", exec_shutdown); - } + plugin_register_config ("exec", exec_config, config_keys, config_keys_num); + plugin_register_read ("exec", exec_read); + plugin_register_shutdown ("exec", exec_shutdown); } /* void module_register */ /* diff --git a/src/hddtemp.c b/src/hddtemp.c index 505d10f5..00814bd2 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -50,16 +50,6 @@ #define HDDTEMP_DEF_HOST "127.0.0.1" #define HDDTEMP_DEF_PORT "7634" -static data_source_t data_source_temperature[1] = -{ - {"value", DS_TYPE_GAUGE, -273.15, NAN} -}; - -static data_set_t temperature_ds = -{ - "temperature", 1, data_source_temperature -}; - #if HDDTEMP_HAVE_READ static const char *config_keys[] = { @@ -514,18 +504,12 @@ static int hddtemp_read (void) /* module_register Register collectd plugin. */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&temperature_ds); - #if HDDTEMP_HAVE_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); - } + 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 960cc622..c439ebd6 100644 --- a/src/interface.c +++ b/src/interface.c @@ -67,40 +67,6 @@ /* * (Module-)Global variables */ -/* 2^32 = 4294967296 = ~4.2GByte/s = ~34GBit/s */ -static data_source_t octets_dsrc[2] = -{ - {"rx", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"tx", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t octets_ds = -{ - "if_octets", 2, octets_dsrc -}; - -static data_source_t packets_dsrc[2] = -{ - {"rx", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"tx", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t packets_ds = -{ - "if_packets", 2, packets_dsrc -}; - -static data_source_t errors_dsrc[2] = -{ - {"rx", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"tx", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t errors_ds = -{ - "if_errors", 2, errors_dsrc -}; - static const char *config_keys[] = { "Interface", @@ -389,25 +355,14 @@ static int interface_read (void) } /* int interface_read */ #endif /* INTERFACE_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 1df35fa0..5f2745f2 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -47,22 +47,6 @@ * them Although other collectd models don't seem to care much for options * eitherway for what to log */ -/* Limit to ~125MByte/s (~1GBit/s) */ -static data_source_t dsrc[1] = -{ - {"value", DS_TYPE_COUNTER, 0.0, 134217728.0} -}; - -static data_set_t ipt_bytes_ds = -{ - "ipt_bytes", 1, dsrc -}; - -static data_set_t ipt_packets_ds = -{ - "ipt_packets", 1, dsrc -}; - #if IPTABLES_HAVE_READ /* * Config format should be `Chain table chainname', @@ -358,22 +342,13 @@ static int iptables_shutdown (void) } /* int iptables_shutdown */ #endif /* IPTABLES_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - { - plugin_register_data_set (&ipt_bytes_ds); - plugin_register_data_set (&ipt_packets_ds); - } - #if IPTABLES_HAVE_READ - 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); - } + 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 */ diff --git a/src/irq.c b/src/irq.c index 3df9d869..1c7b5aec 100644 --- a/src/irq.c +++ b/src/irq.c @@ -36,16 +36,6 @@ /* * (Module-)Global variables */ -static data_source_t dsrc_irq[1] = -{ - {"value", DS_TYPE_COUNTER, 0, 65535.0} -}; - -static data_set_t ds_irq = -{ - "irq", 1, dsrc_irq -}; - #if IRQ_HAVE_READ static const char *config_keys[] = { @@ -214,18 +204,12 @@ static int irq_read (void) } /* int irq_read */ #endif /* IRQ_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&ds_irq); - #if IRQ_HAVE_READ - if (load & MR_READ) - { - plugin_register_config ("irq", irq_config, - config_keys, config_keys_num); - plugin_register_read ("irq", irq_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 */ diff --git a/src/load.c b/src/load.c index 7be594d1..5e1d9d30 100644 --- a/src/load.c +++ b/src/load.c @@ -41,18 +41,6 @@ #endif #endif /* defined(HAVE_GETLOADAVG) */ -static data_source_t dsrc[3] = -{ - {"shortterm", DS_TYPE_GAUGE, 0.0, 100.0}, - {"midterm", DS_TYPE_GAUGE, 0.0, 100.0}, - {"longterm", DS_TYPE_GAUGE, 0.0, 100.0} -}; - -static data_set_t ds = -{ - "load", 3, dsrc -}; - #if LOAD_HAVE_READ static void load_submit (gauge_t snum, gauge_t mnum, gauge_t lnum) { @@ -149,13 +137,9 @@ static int load_read (void) } #endif /* LOAD_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&ds); - #if LOAD_HAVE_READ - if (load & MR_READ) - plugin_register_read ("load", load_read); + plugin_register_read ("load", load_read); #endif } /* void module_register */ diff --git a/src/logfile.c b/src/logfile.c index 5cb40914..102f12b3 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -113,7 +113,7 @@ static void logfile_log (int severity, const char *msg) return; } /* void logfile_log (int, const char *) */ -void module_register (modreg_e load) +void module_register (void) { plugin_register_config ("logfile", logfile_config, config_keys, config_keys_num); diff --git a/src/mbmon.c b/src/mbmon.c index 08c49fe3..68a09850 100644 --- a/src/mbmon.c +++ b/src/mbmon.c @@ -39,36 +39,6 @@ #define MBMON_DEF_HOST "127.0.0.1" #define MBMON_DEF_PORT "411" /* the default for Debian */ -static data_source_t data_source_fanspeed[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t fanspeed_ds = -{ - "fanspeed", 1, data_source_fanspeed -}; - -static data_source_t data_source_temperature[1] = -{ - {"value", DS_TYPE_GAUGE, -273.15, NAN} -}; - -static data_set_t temperature_ds = -{ - "temperature", 1, data_source_temperature -}; - -static data_source_t data_source_voltage[1] = -{ - {"voltage", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t voltage_ds = -{ - "voltage", 1, data_source_voltage -}; - static const char *config_keys[] = { "Host", @@ -339,20 +309,10 @@ static int mbmon_read (void) /* module_register Register collectd plugin. */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - { - plugin_register_config ("mbmon", mbmon_config, config_keys, config_keys_num); - plugin_register_read ("mbmon", mbmon_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 9f954a4c..e169503c 100644 --- a/src/memory.c +++ b/src/memory.c @@ -49,17 +49,6 @@ # define MEMORY_HAVE_READ 0 #endif -/* 2^48 = 281474976710656 */ -static data_source_t dsrc[4] = -{ - {"value", DS_TYPE_GAUGE, 0, 281474976710656.0} -}; - -static data_set_t ds = -{ - "memory", 1, dsrc -}; - /* vm_statistics_data_t */ #if defined(HOST_VM_INFO) static mach_port_t port_host; @@ -336,16 +325,10 @@ static int memory_read (void) } #endif /* MEMORY_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&ds); - #if MEMORY_HAVE_READ - if (load & MR_READ) - { - plugin_register_init ("memory", memory_init); - plugin_register_read ("memory", memory_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 02abfc8a..21a21447 100644 --- a/src/multimeter.c +++ b/src/multimeter.c @@ -36,16 +36,6 @@ # error "multimeter cannot read!" #endif -static data_source_t data_source[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t data_set = -{ - "multimeter", 1, data_source -}; - #if MULTIMETER_HAVE_READ static int fd = -1; @@ -260,17 +250,11 @@ static int multimeter_shutdown (void) } #endif /* MULTIMETER_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&data_set); - #if MULTIMETER_HAVE_READ - if (load & MR_READ) - { - plugin_register_init ("multimeter", multimeter_init); - plugin_register_read ("multimeter", multimeter_read); - plugin_register_shutdown ("multimeter", multimeter_shutdown); - } + 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 5fbe5a66..fccaedbd 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -36,59 +36,6 @@ /* TODO: Understand `Select_*' and possibly do that stuff as well.. */ -static data_source_t data_source_counter[1] = -{ - {"value", DS_TYPE_COUNTER, 0, NAN} -}; - -static data_set_t ds_commands = -{ - "mysql_commands", 1, data_source_counter -}; - -static data_set_t ds_handler = -{ - "mysql_handler", 1, data_source_counter -}; - -static data_source_t data_source_qcache[5] = -{ - {"hits", DS_TYPE_COUNTER, 0, NAN}, - {"inserts", DS_TYPE_COUNTER, 0, NAN}, - {"not_cached", DS_TYPE_COUNTER, 0, NAN}, - {"lowmem_prunes", DS_TYPE_COUNTER, 0, NAN}, - {"queries_in_cache", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t ds_qcache = -{ - "mysql_qcache", 5, data_source_qcache -}; - -static data_source_t data_source_threads[4] = -{ - {"running", DS_TYPE_GAUGE, 0, NAN}, - {"connected", DS_TYPE_GAUGE, 0, NAN}, - {"cached", DS_TYPE_GAUGE, 0, NAN}, - {"created", DS_TYPE_COUNTER, 0, NAN} -}; - -static data_set_t ds_threads = -{ - "mysql_threads", 4, data_source_threads -}; - -static data_source_t data_source_octets[2] = -{ - {"rx", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"tx", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t ds_octets = -{ - "mysql_octets", 2, data_source_octets -}; - #if MYSQL_HAVE_READ static const char *config_keys[] = { @@ -377,22 +324,10 @@ static int mysql_read (void) } /* int mysql_read */ #endif /* MYSQL_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - { - plugin_register_config ("mysql", config, config_keys, config_keys_num); - plugin_register_read ("mysql", mysql_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 4b50ce2d..a426c136 100644 --- a/src/network.c +++ b/src/network.c @@ -1343,7 +1343,7 @@ static int network_init (void) return (0); } /* int network_init */ -void module_register (modreg_e load) +void module_register (void) { plugin_register_config ("network", network_config, config_keys, config_keys_num); diff --git a/src/nfs.c b/src/nfs.c index 40e4110b..299d63b9 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -76,16 +76,6 @@ Number Procedures Procedures 21 commit */ -static data_source_t procedure_dsrc[1] = -{ - {"value", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t procedure_ds = -{ - "nfs_procedure", 1, procedure_dsrc -}; - #if NFS_HAVE_READ static const char *nfs2_procedures_names[] = { @@ -378,13 +368,9 @@ static int nfs_read (void) } #endif /* NFS_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&procedure_ds); - #if NFS_HAVE_READ - if (load & MR_READ) - plugin_register_read ("nfs", nfs_read); + plugin_register_read ("nfs", nfs_read); #endif } /* void module_register */ diff --git a/src/ntpd.c b/src/ntpd.c index 7f4d62a0..83bf1628 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -52,36 +52,6 @@ # include #endif -static data_source_t seconds_dsrc[1] = -{ - {"seconds", DS_TYPE_GAUGE, -1000000.0, 1000000.0} -}; - -static data_set_t time_offset_ds = -{ - "time_offset", 1, seconds_dsrc -}; - -static data_set_t time_dispersion_ds = -{ - "time_dispersion", 1, seconds_dsrc -}; - -static data_set_t delay_ds = -{ - "delay", 1, seconds_dsrc -}; - -static data_source_t ppm_dsrc[1] = -{ - {"ppm", DS_TYPE_GAUGE, -1000000.0, 1000000.0} -}; - -static data_set_t frequency_offset_ds = -{ - "frequency_offset", 1, ppm_dsrc -}; - static const char *config_keys[] = { "Host", @@ -960,22 +930,11 @@ static int ntpd_read (void) } /* int ntpd_read */ #endif /* NTPD_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - { - plugin_register_config ("ntpd", ntpd_config, - config_keys, config_keys_num); - plugin_register_read ("ntpd", ntpd_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/nut.c b/src/nut.c index f6b9fafd..6af12b82 100644 --- a/src/nut.c +++ b/src/nut.c @@ -34,86 +34,6 @@ # define NUT_HAVE_READ 0 #endif -static data_source_t data_source_current[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t ds_current = -{ - "current", 1, data_source_current -}; - -static data_source_t data_source_humidity[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 100.0} -}; - -static data_set_t ds_humidity = -{ - "humidity", 1, data_source_humidity -}; - -static data_source_t data_source_power[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, NAN} -}; - -static data_set_t ds_power = -{ - "power", 1, data_source_power -}; - -static data_source_t data_source_voltage[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t ds_voltage = -{ - "voltage", 1, data_source_voltage -}; - -static data_source_t data_source_percent[1] = -{ - {"percent", DS_TYPE_GAUGE, 0, 100.1} -}; - -static data_set_t ds_percent = -{ - "percent", 1, data_source_percent -}; - -static data_source_t data_source_timeleft[1] = -{ - {"timeleft", DS_TYPE_GAUGE, 0, 100.0} -}; - -static data_set_t ds_timeleft = -{ - "timeleft", 1, data_source_timeleft -}; - -static data_source_t data_source_temperature[1] = -{ - {"value", DS_TYPE_GAUGE, -273.15, NAN} -}; - -static data_set_t ds_temperature = -{ - "temperature", 1, data_source_temperature -}; - -static data_source_t data_source_frequency[1] = -{ - {"frequency", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t ds_frequency = -{ - "frequency", 1, data_source_frequency -}; - #if NUT_HAVE_READ struct nut_ups_s; typedef struct nut_ups_s nut_ups_t; @@ -368,27 +288,12 @@ static int nut_shutdown (void) } /* int nut_shutdown */ #endif /* NUT_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - { - plugin_register_data_set (&ds_current); - plugin_register_data_set (&ds_humidity); - plugin_register_data_set (&ds_power); - 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); - } - #if NUT_HAVE_READ - if (load & MR_READ) - { - plugin_register_config ("nut", nut_config, config_keys, config_keys_num); - plugin_register_read ("nut", nut_read); - plugin_register_shutdown ("nut", nut_shutdown); - } + plugin_register_config ("nut", nut_config, config_keys, config_keys_num); + plugin_register_read ("nut", nut_read); + plugin_register_shutdown ("nut", nut_shutdown); #endif } /* void module_register */ diff --git a/src/perl.c b/src/perl.c index c9977496..021d3093 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1069,7 +1069,7 @@ static void xs_init (pTHX) /* * Create the perl interpreter and register it with collectd. */ -void module_register (modreg_e load) +void module_register (void) { char *embed_argv[] = { "", "-e", "bootstrap Collectd \""VERSION"\"", NULL }; int embed_argc = 3; @@ -1103,8 +1103,7 @@ void module_register (modreg_e load) plugin_register_config ("perl", perl_config, config_keys, config_keys_num); plugin_register_init ("perl", perl_init); - if (load & MR_READ) - plugin_register_read ("perl", perl_read); + plugin_register_read ("perl", perl_read); plugin_register_write ("perl", perl_write); plugin_register_shutdown ("perl", perl_shutdown); diff --git a/src/ping.c b/src/ping.c index eb716a47..3c700668 100644 --- a/src/ping.c +++ b/src/ping.c @@ -45,16 +45,6 @@ typedef struct hostlist_s hostlist_t; static pingobj_t *pingobj = NULL; static hostlist_t *hosts = NULL; -static data_source_t dsrc[1] = -{ - {"ping", DS_TYPE_GAUGE, 0, 65535.0}, -}; - -static data_set_t ds = -{ - "ping", 1, dsrc -}; - static const char *config_keys[] = { "Host", @@ -259,16 +249,10 @@ static int ping_read (void) return (number_of_hosts == 0 ? -1 : 0); } /* int ping_read */ -void module_register (modreg_e load) +void module_register (void) { - 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); - } + 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 33636507..495e1693 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -118,10 +118,10 @@ static int plugin_unregister (llist_t *list, const char *name) * object, but it will bitch about a shared object not having a * ``module_register'' symbol.. */ -static int plugin_load_file (char *file, modreg_e load) +static int plugin_load_file (char *file) { lt_dlhandle dlh; - void (*reg_handle) (modreg_e mr); + void (*reg_handle) (void); DEBUG ("file = %s", file); @@ -137,7 +137,7 @@ static int plugin_load_file (char *file, modreg_e load) return (1); } - if ((reg_handle = (void (*) (modreg_e)) lt_dlsym (dlh, "module_register")) == NULL) + if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL) { WARNING ("Couldn't find symbol ``module_register'' in ``%s'': %s\n", file, lt_dlerror ()); @@ -145,7 +145,7 @@ static int plugin_load_file (char *file, modreg_e load) return (-1); } - (*reg_handle) (load); + (*reg_handle) (); return (0); } @@ -293,7 +293,7 @@ void plugin_set_dir (const char *dir) } #define BUFSIZE 512 -int plugin_load (const char *type, modreg_e mr) +int plugin_load (const char *type) { DIR *dh; const char *dir; @@ -350,7 +350,7 @@ int plugin_load (const char *type, modreg_e mr) continue; } - if (plugin_load_file (filename, mr) == 0) + if (plugin_load_file (filename) == 0) { /* success */ ret = 0; diff --git a/src/plugin.h b/src/plugin.h index 0164e9cf..db556fce 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -46,15 +46,6 @@ /* * 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; @@ -138,7 +129,7 @@ void plugin_set_dir (const char *dir); * NOTES * No attempt is made to re-load an already loaded module. */ -int plugin_load (const char *name, modreg_e mr); +int plugin_load (const char *name); void plugin_init_all (void); void plugin_read_all (const int *loop); diff --git a/src/processes.c b/src/processes.c index f57f2d31..5a29236d 100644 --- a/src/processes.c +++ b/src/processes.c @@ -92,63 +92,6 @@ #define BUFSIZE 256 -static data_source_t state_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 65535.0} -}; - -static data_set_t state_ds = -{ - "ps_state", 1, state_dsrc -}; - -static data_source_t rss_dsrc[1] = -{ - /* max = 2^63 - 1 */ - {"value", DS_TYPE_GAUGE, 0.0, 9223372036854775807.0} -}; - -static data_set_t rss_ds = -{ - "ps_rss", 1, rss_dsrc -}; - -static data_source_t time_dsrc[2] = -{ - /* 1 second in user-mode per second ought to be enough.. */ - {"user", DS_TYPE_COUNTER, 0.0, 1000000.0}, - {"syst", DS_TYPE_COUNTER, 0.0, 1000000.0} -}; - -static data_set_t time_ds = -{ - "ps_cputime", 2, time_dsrc -}; - -static data_source_t count_dsrc[2] = -{ - /* 1 second in user-mode per second ought to be enough.. */ - {"processes", DS_TYPE_GAUGE, 0.0, 1000000.0}, - {"threads", DS_TYPE_GAUGE, 0.0, 1000000.0} -}; - -static data_set_t count_ds = -{ - "ps_count", 2, count_dsrc -}; - -static data_source_t pagefaults_dsrc[2] = -{ - /* max = 2^63 - 1 */ - {"minflt", DS_TYPE_COUNTER, 0.0, 9223372036854775807.0}, - {"majflt", DS_TYPE_COUNTER, 0.0, 9223372036854775807.0} -}; - -static data_set_t pagefaults_ds = -{ - "ps_pagefaults", 2, pagefaults_dsrc -}; - #if PROCESSES_HAVE_READ #if HAVE_THREAD_INFO | KERNEL_LINUX static const char *config_keys[] = @@ -1075,26 +1018,14 @@ static int ps_read (void) } /* int ps_read */ #endif /* PROCESSES_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 b4bb3fbe..7395bcdc 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -870,7 +870,7 @@ static int rrd_init (void) return (0); } /* int rrd_init */ -void module_register (modreg_e load) +void module_register (void) { plugin_register_config ("rrdtool", rrd_config, config_keys, config_keys_num); diff --git a/src/sensors.c b/src/sensors.c index 551d267c..6ed8ddd3 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -46,36 +46,6 @@ # define SENSORS_HAVE_READ 0 #endif -static data_source_t data_source_fanspeed[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t fanspeed_ds = -{ - "fanspeed", 1, data_source_fanspeed -}; - -static data_source_t data_source_temperature[1] = -{ - {"value", DS_TYPE_GAUGE, -273.15, NAN} -}; - -static data_set_t temperature_ds = -{ - "temperature", 1, data_source_temperature -}; - -static data_source_t data_source_voltage[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, NAN} -}; - -static data_set_t voltage_ds = -{ - "voltage", 1, data_source_voltage -}; - #if SENSORS_HAVE_READ #define SENSOR_TYPE_VOLTAGE 0 #define SENSOR_TYPE_FANSPEED 1 @@ -449,22 +419,12 @@ static int sensors_read (void) } /* int sensors_read */ #endif /* SENSORS_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - 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); - } + 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 c2786720..dd063bb5 100644 --- a/src/serial.c +++ b/src/serial.c @@ -31,17 +31,6 @@ # define SERIAL_HAVE_READ 0 #endif -static data_source_t octets_dsrc[2] = -{ - {"rx", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"tx", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t octets_ds = -{ - "serial_octets", 2, octets_dsrc -}; - #if SERIAL_HAVE_READ static void serial_submit (const char *type_instance, counter_t rx, counter_t tx) @@ -136,13 +125,9 @@ static int serial_read (void) } /* int serial_read */ #endif /* SERIAL_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&octets_ds); - #if SERIAL_HAVE_READ - if (load & MR_READ) - plugin_register_read ("serial", serial_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 86bdc352..3018cb9e 100644 --- a/src/swap.c +++ b/src/swap.c @@ -45,16 +45,6 @@ #undef MAX #define MAX(x,y) ((x) > (y) ? (x) : (y)) -static data_source_t data_source[1] = -{ - {"value", DS_TYPE_GAUGE, 0, 1099511627776.0} -}; - -static data_set_t data_set = -{ - "swap", 1, data_source -}; - #if SWAP_HAVE_READ #if KERNEL_LINUX /* No global variables */ @@ -312,16 +302,10 @@ static int swap_read (void) } /* int swap_read */ #endif /* SWAP_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&data_set); - #if SWAP_HAVE_READ - if (load & MR_READ) - { - plugin_register_init ("swap", swap_init); - plugin_register_read ("swap", swap_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 d643e39a..08dadcb9 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -86,7 +86,7 @@ static int sl_shutdown (void) return (0); } -void module_register (modreg_e load) +void module_register (void) { plugin_register_config ("syslog", sl_config, config_keys, config_keys_num); plugin_register_init ("syslog", sl_init); diff --git a/src/tape.c b/src/tape.c index 61ce3ac7..5e01f0d8 100644 --- a/src/tape.c +++ b/src/tape.c @@ -30,52 +30,6 @@ # define TAPE_HAVE_READ 0 #endif -/* 2^34 = 17179869184 = ~17.2GByte/s */ -static data_source_t octets_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 17179869183.0}, - {"write", DS_TYPE_COUNTER, 0, 17179869183.0} -}; - -static data_set_t octets_ds = -{ - "tape_octets", 2, octets_dsrc -}; - -static data_source_t operations_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"write", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t operations_ds = -{ - "tape_ops", 2, operations_dsrc -}; - -static data_source_t merged_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"write", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t merged_ds = -{ - "tape_merged", 2, merged_dsrc -}; - -/* max is 1000000us per second. */ -static data_source_t time_dsrc[2] = -{ - {"read", DS_TYPE_COUNTER, 0, 1000000.0}, - {"write", DS_TYPE_COUNTER, 0, 1000000.0} -}; - -static data_set_t time_ds = -{ - "tape_time", 2, time_dsrc -}; - #if TAPE_HAVE_READ #if defined(HAVE_LIBKSTAT) #define MAX_NUMTAPE 256 @@ -182,21 +136,10 @@ static int tape_read (void) } #endif /* TAPE_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - { - plugin_register_init ("tape", tape_init); - plugin_register_read ("tape", tape_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 1ddd03cf..ac7828fe 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -857,7 +857,7 @@ static int us_write (const data_set_t *ds, const value_list_t *vl) return (0); } -void module_register (modreg_e load) +void module_register (void) { plugin_register_config ("unixsock", us_config, config_keys, config_keys_num); diff --git a/src/users.c b/src/users.c index e600aab3..6768d55d 100644 --- a/src/users.c +++ b/src/users.c @@ -40,16 +40,6 @@ # define USERS_HAVE_READ 0 #endif -static data_source_t dsrc[1] = -{ - {"users", DS_TYPE_GAUGE, 0.0, 65535.0} -}; - -static data_set_t ds = -{ - "users", 1, dsrc -}; - #if USERS_HAVE_READ static void users_submit (gauge_t value) { @@ -109,13 +99,9 @@ static int users_read (void) } /* int users_read */ #endif /* USERS_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - if (load & MR_DATASETS) - plugin_register_data_set (&ds); - #if USERS_HAVE_READ - if (load & MR_READ) - plugin_register_read ("users", users_read); + plugin_register_read ("users", users_read); #endif } /* void module_register(void) */ diff --git a/src/vserver.c b/src/vserver.c index 2e390609..651844fc 100644 --- a/src/vserver.c +++ b/src/vserver.c @@ -38,59 +38,6 @@ # define VSERVER_HAVE_READ 0 #endif /* defined(KERNEL_LINUX) */ -static data_source_t octets_dsrc[2] = -{ - {"rx", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"tx", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t octets_ds = -{ - "if_octets", 2, octets_dsrc -}; - -static data_source_t load_dsrc[3] = -{ - {"shortterm", DS_TYPE_GAUGE, 0.0, 100.0}, - {"midterm", DS_TYPE_GAUGE, 0.0, 100.0}, - {"longterm", DS_TYPE_GAUGE, 0.0, 100.0} -}; - -static data_set_t load_ds = -{ - "load", 3, load_dsrc -}; - -static data_source_t threads_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 65535.0} -}; - -static data_set_t threads_ds = -{ - "vs_threads", 1, threads_dsrc -}; - -static data_source_t processes_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 65535.0} -}; - -static data_set_t processes_ds = -{ - "vs_processes", 1, processes_dsrc -}; - -static data_source_t memory_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 9223372036854775807.0} -}; - -static data_set_t memory_ds = -{ - "vs_memory", 1, memory_dsrc -}; - #if VSERVER_HAVE_READ static int pagesize = 0; @@ -362,23 +309,11 @@ static int vserver_read (void) } /* int vserver_read */ #endif /* VSERVER_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - { - plugin_register_init ("vserver", vserver_init); - plugin_register_read ("vserver", vserver_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 007272e1..81c968e8 100644 --- a/src/wireless.c +++ b/src/wireless.c @@ -31,31 +31,6 @@ #define WIRELESS_PROC_FILE "/proc/net/wireless" -static data_source_t data_source_quality[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t quality_ds = -{ - "signal_quality", 1, data_source_quality -}; - -static data_source_t data_source_signal[1] = -{ - {"value", DS_TYPE_GAUGE, NAN, 0} -}; - -static data_set_t power_ds = -{ - "signal_power", 1, data_source_signal -}; - -static data_set_t noise_ds = -{ - "signal_noise", 1, data_source_signal -}; - #if WIRELESS_HAVE_READ #if 0 static double wireless_dbm_to_watt (double dbm) @@ -167,17 +142,9 @@ static int wireless_read (void) } /* int wireless_read */ #endif /* WIRELESS_HAVE_READ */ -void module_register (modreg_e load) +void module_register (void) { - 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 - if (load & MR_READ) - plugin_register_read ("wireless", wireless_read); + plugin_register_read ("wireless", wireless_read); #endif /* WIRELESS_HAVE_READ */ } /* void module_register */