author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 10 Feb 2007 10:30:18 +0000 (11:30 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 10 Feb 2007 10:30:18 +0000 (11:30 +0100) |
Conflicts:
configure.in
src/processes.c
configure.in
src/processes.c
1 | 2 | |||
---|---|---|---|---|
configure.in | patch | | diff1 | | diff2 | | blob | history |
src/Makefile.am | patch | | diff1 | | diff2 | | blob | history |
src/dns.c | patch | | diff1 | | diff2 | | blob | history |
src/processes.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc configure.in
index ba936d8dd02a555fb46e418230af87f8878aad9b,e30aaa977eed093a0bc08937cb70ff234a2ba5df..09e1a185e0d5bd6d879a78003306bbc038d55608
--- 1/configure.in
--- 2/configure.in
+++ b/configure.in
# include <netinet/ip6.h>
#endif
])
++AC_CHECK_HEADERS(netinet/tcp.h, [], [],
++[#if HAVE_STDINT_H
++# include <stdint.h>
++#endif
++#if HAVE_SYS_TYPES_H
++# include <sys/types.h>
++#endif
++#if HAVE_NETINET_IN_SYSTM_H
++# include <netinet/in_systm.h>
++#endif
++#if HAVE_NETINET_IN_H
++# include <netinet/in.h>
++#endif
++#if HAVE_NETINET_IP_H
++# include <netinet/ip.h>
++#endif
++])
+ AC_CHECK_HEADERS(netinet/udp.h, [], [],
+ [#if HAVE_STDINT_H
+ # include <stdint.h>
+ #endif
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #if HAVE_NETINET_IN_SYSTM_H
+ # include <netinet/in_systm.h>
+ #endif
+ #if HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ #if HAVE_NETINET_IP_H
+ # include <netinet/ip.h>
+ #endif
+ ])
# For cpu modules
AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
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/Makefile.am
Simple merge
diff --cc src/dns.c
index d4e56dac059ca6ede79ecfbcea0148fea6a2aa5c,cd73a7e0c7b227d0c5cfcd61d4e92bbe593be3ac..332ef0ea2c25a2305e1d08255e2cdf57e33f3232
+++ b/src/dns.c
#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 <pthread.h>
# include <pcap.h>
-# include <sys/poll.h>
+# include <poll.h>
# define DNS_HAVE_READ 1
#else
# define DNS_HAVE_READ 0
diff --cc src/processes.c
index b1f9fbbefea6356ed4f34995f0b1cf5793a572c6,68984458058df5e69769662b7086833867d22c00..c22f0f6f8265e160f61971624a58955744c24638
--- 1/src/processes.c
--- 2/src/processes.c
+++ b/src/processes.c
#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 char *config_keys[] =
+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[] =
{
"Process",
NULL
} /* 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)
{
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;
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