From: Florian Forster Date: Sat, 10 Feb 2007 10:30:18 +0000 (+0100) Subject: Merge branch 'collectd-3.11' into merge/collectd-4 X-Git-Tag: collectd-4.0.0~197 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=79d36d9eb61ac09f253769feff144383b2b665c9;p=collectd.git Merge branch 'collectd-3.11' into merge/collectd-4 Conflicts: configure.in src/processes.c --- 79d36d9eb61ac09f253769feff144383b2b665c9 diff --cc configure.in index ba936d8d,e30aaa97..09e1a185 --- a/configure.in +++ b/configure.in @@@ -149,6 -149,23 +149,40 @@@ AC_CHECK_HEADERS(netinet/icmp6.h, [], [ # include #endif ]) ++AC_CHECK_HEADERS(netinet/tcp.h, [], [], ++[#if HAVE_STDINT_H ++# include ++#endif ++#if HAVE_SYS_TYPES_H ++# include ++#endif ++#if HAVE_NETINET_IN_SYSTM_H ++# include ++#endif ++#if HAVE_NETINET_IN_H ++# include ++#endif ++#if HAVE_NETINET_IP_H ++# include ++#endif ++]) + AC_CHECK_HEADERS(netinet/udp.h, [], [], + [#if HAVE_STDINT_H + # include + #endif + #if HAVE_SYS_TYPES_H + # include + #endif + #if HAVE_NETINET_IN_SYSTM_H + # include + #endif + #if HAVE_NETINET_IN_H + # include + #endif + #if HAVE_NETINET_IP_H + # include + #endif + ]) # For cpu modules AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h) @@@ -291,13 -308,7 +325,11 @@@ AC_CHECK_HEADERS(arpa/nameser.h arpa/na AC_CHECK_HEADERS(net/if_arp.h) AC_CHECK_HEADERS(net/if_ppp.h) AC_CHECK_HEADERS(netinet/if_ether.h) - AC_CHECK_HEADERS(netinet/tcp.h) - AC_CHECK_HEADERS(netinet/udp.h) +# For the multimeter plugin +AC_CHECK_HEADERS(termios.h) +AC_CHECK_HEADERS(sys/ioctl.h) + dnl Checking for libraries AC_CHECK_LIB(m, ext) diff --cc src/dns.c index d4e56dac,cd73a7e0..332ef0ea --- a/src/dns.c +++ b/src/dns.c @@@ -24,12 -25,14 +24,12 @@@ #include "plugin.h" #include "configfile.h" #include "utils_debug.h" - #include "utils_dns.h" -#define MODULE_NAME "dns" - #if HAVE_LIBPCAP && HAVE_LIBPTHREAD + # include "utils_dns.h" # include # include -# include +# include # define DNS_HAVE_READ 1 #else # define DNS_HAVE_READ 0 diff --cc src/processes.c index b1f9fbbe,68984458..c22f0f6f --- a/src/processes.c +++ b/src/processes.c @@@ -93,65 -93,59 +93,66 @@@ #define BUFSIZE 256 -static char *processes_file = "processes.rrd"; -static char *processes_ds_def[] = +static data_source_t state_dsrc[1] = { - "DS:running:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - "DS:sleeping:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - "DS:zombies:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - "DS:stopped:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - "DS:paging:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - "DS:blocked:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - NULL + {"value", DS_TYPE_GAUGE, 0.0, 65535.0} }; -static int processes_ds_num = 6; -static char *ps_rss_file = "processes/ps_rss-%s.rrd"; -static char *ps_rss_ds_def[] = +static data_set_t state_ds = +{ + "ps_state", 1, state_dsrc +}; + +static data_source_t rss_dsrc[1] = { /* max = 2^63 - 1 */ - "DS:byte:GAUGE:"COLLECTD_HEARTBEAT":0:9223372036854775807", - NULL + {"value", DS_TYPE_GAUGE, 0.0, 9223372036854775807.0} }; -static int ps_rss_ds_num = 1; -static char *ps_cputime_file = "processes/ps_cputime-%s.rrd"; -static char *ps_cputime_ds_def[] = +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.. */ - "DS:user:COUNTER:"COLLECTD_HEARTBEAT":0:1000000", - "DS:syst:COUNTER:"COLLECTD_HEARTBEAT":0:1000000", - NULL + {"user", DS_TYPE_COUNTER, 0.0, 1000000.0}, + {"syst", DS_TYPE_COUNTER, 0.0, 1000000.0} }; -static int ps_cputime_ds_num = 2; -static char *ps_count_file = "processes/ps_count-%s.rrd"; -static char *ps_count_ds_def[] = +static data_set_t time_ds = { - "DS:processes:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - "DS:threads:GAUGE:"COLLECTD_HEARTBEAT":0:65535", - NULL + "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 int ps_count_ds_num = 2; -static char *ps_pagefaults_file = "processes/ps_pagefaults-%s.rrd"; -static char *ps_pagefaults_ds_def[] = +static data_set_t count_ds = +{ + "ps_count", 2, count_dsrc +}; + +static data_source_t pagefaults_dsrc[2] = { /* max = 2^63 - 1 */ - "DS:minflt:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807", - "DS:majflt:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807", - NULL + {"minflt", DS_TYPE_COUNTER, 0.0, 9223372036854775807.0}, + {"majflt", DS_TYPE_COUNTER, 0.0, 9223372036854775807.0} }; -static int ps_pagefaults_ds_num = 2; +static data_set_t pagefaults_ds = +{ + "ps_pagefaults", 2, pagefaults_dsrc +}; + +#if PROCESSES_HAVE_READ + #if HAVE_THREAD_INFO | KERNEL_LINUX -static char *config_keys[] = +static const char *config_keys[] = { "Process", NULL @@@ -410,9 -407,8 +414,8 @@@ static void ps_list_reset (void } /* while (pse != NULL) */ } /* for (ps = list_head_g; ps != NULL; ps = ps->next) */ } - #endif /* HAVE_THREAD_INFO | KERNEL_LINUX */ -static int ps_config (char *key, char *value) +static int ps_config (const char *key, const char *value) { if (strcasecmp (key, "Process") == 0) { @@@ -425,8 -421,9 +428,9 @@@ return (0); } + #endif /* HAVE_THREAD_INFO | KERNEL_LINUX */ -static void ps_init (void) +static int ps_init (void) { #if HAVE_THREAD_INFO kern_return_t status; @@@ -1076,17 -1134,15 +1080,19 @@@ static int ps_read (void void module_register (void) { - plugin_register (MODULE_NAME, ps_init, ps_read, ps_write); - plugin_register ("ps_rss", NULL, NULL, ps_rss_write); - plugin_register ("ps_cputime", NULL, NULL, ps_cputime_write); - plugin_register ("ps_count", NULL, NULL, ps_count_write); - plugin_register ("ps_pagefaults", NULL, NULL, ps_pagefaults_write); + 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 HAVE_THREAD_INFO | KERNEL_LINUX - cf_register (MODULE_NAME, 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); +#endif /* PROCESSES_HAVE_READ */ } -#undef BUFSIZE -#undef MODULE_NAME