summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0c9a0c0)
raw | patch | inline | side by side (parent: 0c9a0c0)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 3 May 2007 16:31:49 +0000 (18:31 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 3 May 2007 19:26:59 +0000 (21:26 +0200) |
43 files changed:
diff --git a/src/apache.c b/src/apache.c
index 4184247cbe89150fe87496dfc24bb9fca69f19a9..573a116a215bdeabc0e52feb8e1ca44c11970687 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
# 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;
} /* 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 2539c32f5c308972c953f965fb2daf00ca60c628..75de03e82a82072c27a990f77804c2c1ca5a7fc2 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
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",
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 6b3cfc5e0bd13a926bd8465773b90058a56b0cf8..848c212aa4c06062d42c612d1f4a93cb97917e3e 100644 (file)
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
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)
{
} /* 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 bdf461945c7e780be1ed0e7d383054b0c046c7c6..952c56c071f854e0c3fbbc3d12ba7866f2c420bc 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
#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 */
}
#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 45495c1a13d76837d74d3403c7a7960e01dd6e2c..a10314d083ba9769bfbf51b3ef5702695de1663d 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},
- {"LoadDS", dispatch_value_loadds}
+ {"LoadPlugin", dispatch_value_loadplugin}
};
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, 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 d774ca4e764eaf1b2412c22eb77a8e999a7d6384..99e7a6699a11625edf1d16891fe85a00244e61de 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
# 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;
}
#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 e4caf5ffb4015da1bc1a0c98b26d4eca16b2e88c..7a5c8fdf43079d68b1dc0352a5133f8bd5a75143 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
# 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;
#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 5d64fb89f9d7d5f1aeb504020828473492700136..fcd707ebafd573e9d7f8abad85e2fa51cd782992 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
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 afd3e0b1334ae1219f36ab6e7d3cc65db87c0d52..433f4e2cf7116fad666f6065e2ea223aa0df1c8c 100644 (file)
--- a/src/df.c
+++ b/src/df.c
# 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[] =
{
} /* 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 771227064590e9f12cdf2304e52ed0ee0fdec39a..31c3ec2eba01fb008b33d47f17deac86825f47ab 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
# 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;
} /* 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 c9beb166e8f0a6f09c076cd554d244ad031808d6..5af9c20c4d5d5fd042a27c325adcd8dbae9dfe20 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
/*
* 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[] =
{
} /* 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 7738a39b3727a8f2b14a6382524e5f07f3b832a6..b4767554b433c83982685f684ee9232810c126c0 100644 (file)
--- a/src/email.c
+++ b/src/email.c
};
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;
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 fd48c74292561b3c264edd62f1392eb86621f152..7e903953bc10a55dad0f01d17fe231e37d8f4496 100644 (file)
--- a/src/entropy.c
+++ b/src/entropy.c
#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)
{
}
#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 5bddfc5920ff9a09ed33c3b7ded80c1b05adab71..518efc870739169381d1ab51848bc3ec23de42f2 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
/*
* 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"
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 505d10f5bf9c389e024c1d3388ea815e1733c530..00814bd23d36208660595d920bd37f48eef525a7 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
#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[] =
{
/* 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 960cc6220933c78c635cdf185c39a65b8a5d5843..c439ebd60e8625b1bae55ea63b7dd479e018eb70 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
/*
* (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",
} /* 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 1df35fa04d940b2f24e48625c3afc04ba7d0f51f..5f2745f281d65b0325f9e547d8f6e002a03b886c 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
* 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',
} /* 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 3df9d869ee92ba9abbcf9bc9839e01c18456eaad..1c7b5aec90eebfbe09d12f46a8ca3c3da29a1c31 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
/*
* (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[] =
{
} /* 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 7be594d15f26bd8b9a7de2c08f9b93b12716eff1..5e1d9d30a0758fb362661dee1551f9557777b652 100644 (file)
--- a/src/load.c
+++ b/src/load.c
#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)
{
}
#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 5cb409141fbf37158085cd15ef210ee52c4b1b13..102f12b3a9b7589a5d340fadc6f1ef43e89ae888 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
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 08c49fe3096bd0849f040cb2e82a8cb17303264e..68a0985044acdfeaf672b0107dbd94ae59ac88e9 100644 (file)
--- a/src/mbmon.c
+++ b/src/mbmon.c
#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",
/* 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 9f954a4c0d661044ef0b0bd3735fc67be386cf63..e169503c6de742bd89c02c558881d7edbd17253a 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
# 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;
}
#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 02abfc8a9f8d33768577ac59257af6870cebc7d6..21a21447043c84e6896b478c37c0b3a03d09f661 100644 (file)
--- a/src/multimeter.c
+++ b/src/multimeter.c
# 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;
}
#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 5fbe5a662d02cb17b1f779a412e2fc52a9968320..fccaedbdc891eb42a7aceaec38dc468370f54ba7 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
/* 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[] =
{
} /* 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 4b50ce2db727b4ae48f8a4474811e491c9f8b339..a426c136b9399aad522e83eb168010fad77b05cd 100644 (file)
--- a/src/network.c
+++ b/src/network.c
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 40e4110b54029e4e1b0a4d3279a0922c480bf9e8..299d63b9e4b98e56363770eb7003850ea3621f87 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
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[] =
{
}
#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 7f4d62a040b27cc297baa139fde4842197f78e04..83bf1628734c51fb782b87e015fdc075a884e50a 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
# include <poll.h>
#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",
} /* 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 f6b9fafd4c5f441843949362ad7d1f7649f73494..6af12b82def97c8e065cc93dbc0aea7f42faf624 100644 (file)
--- a/src/nut.c
+++ b/src/nut.c
# 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;
} /* 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 c9977496dc95b1ea11e742ed290c6b6fbb157ce2..021d3093606f51dfb374dcb0f97ed6b935277a81 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
/*
* 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;
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 eb716a4771537639bf10b17d1460c56054351f05..3c700668ddef5e11be1c05aff34faa88a1633737 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
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",
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 33636507b1656c9c6d30692bb50f9c0b300ba318..495e1693b91827bd9f50fc6adf5b5ad15367b308 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, 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);
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 ());
return (-1);
}
- (*reg_handle) (load);
+ (*reg_handle) ();
return (0);
}
}
#define BUFSIZE 512
-int plugin_load (const char *type, modreg_e mr)
+int plugin_load (const char *type)
{
DIR *dh;
const char *dir;
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 0164e9cf9a2d032bf5c5bf683c64db756047cda2..db556fce1af18950b75378274c7edebfcb57fcd4 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;
* 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 f57f2d3134bfb237da47f85b89eff544ad42a533..5a29236d8970bdac405775e939b1ca5bf41b4bf4 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
#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[] =
} /* 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 b4bb3fbeda224f5efb88feb4866a7b725d87722d..7395bcdc61c8405601e006c41d1ba695df423ee5 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
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 551d267ca2da0c5d4fdb00eda24b4da404393ca2..6ed8ddd32c034efddbbff42929c6bba74e540e61 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
# 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
} /* 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 c278672086b64d3b6b7474f96241f1975855a27d..dd063bb53bd9a9707ae5bf2ea74cb9d5b4da03f5 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
# 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)
} /* 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 86bdc352d57b28ecc439d928f910df78b94f14d1..3018cb9e754460fca13aeaa524349d4f9e517e3a 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
#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 */
} /* 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 d643e39a4f195d4556ee170113ef1d4b56a5db93..08dadcb9b49a8d17cca6fa846ab0b2ab61df84f2 100644 (file)
--- a/src/syslog.c
+++ b/src/syslog.c
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 61ce3ac755316f5a74b8e0bb90846e4c5888f97a..5e01f0d8a963876549c47e56f3337b0b72888829 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
# 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
}
#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 1ddd03cf35f662160dda195c9de760edf646c384..ac7828fe7fc318b641c9729e057723dc528c5876 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
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 e600aab3ae01e36b33b2946db50b58211a673f5c..6768d55d31a61ac97a36cfdee3465b25720c15d1 100644 (file)
--- a/src/users.c
+++ b/src/users.c
# 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)
{
} /* 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 2e3906097a1882bf1d0d1bc2acf910aed9534965..651844fc06ddc4efc82b70dc7284d2f35bbd68ea 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
# 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;
} /* 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 007272e1ed28bd5bbf2cca0a831a1f6bbdea0d7a..81c968e8d9b4e462a57129b6c37cb7fdd05e303d 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
#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)
} /* 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 */