# 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)
#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