summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fca4106)
raw | patch | inline | side by side (parent: fca4106)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 18 Jun 2006 13:22:52 +0000 (15:22 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 18 Jun 2006 13:22:52 +0000 (15:22 +0200) |
src/processes.c | patch | blob | history |
diff --git a/src/processes.c b/src/processes.c
index 182e15dcf77107365ba818b20493267fdfa42619..16e6059f144430729f6ca267dbafc0078b022294 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
};
static int processes_ds_num = 6;
+static char *ps_rss_file = "processes/ps_rss-%s.rrd";
+static char *ps_rss_ds_def[] =
+{
+ /* max = 2^63 - 1 */
+ "DS:byte:GAUGE:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ NULL
+};
+static int ps_rss_ds_num = 1;
+
static char *config_keys[] =
{
"CollectName",
#elif KERNEL_LINUX
pagesize_g = sysconf(_SC_PAGESIZE);
+ DBG ("pagesize_g = %li; CONFIG_HZ = %i;",
+ pagesize_g, CONFIG_HZ);
#endif /* KERNEL_LINUX */
return;
processes_ds_def, processes_ds_num);
}
+static void ps_rss_write (char *host, char *inst, char *val)
+{
+ char filename[256];
+ int status;
+
+ status = snprintf (filename, 256, ps_rss_file, inst);
+ if ((status < 1) || (status >= 256))
+ return;
+
+ rrd_update_file (host, filename, val, ps_rss_ds_def, ps_rss_ds_num);
+}
+
#if PROCESSES_HAVE_READ
static void ps_submit (int running,
int sleeping,
static void ps_submit_proc (procstat_t *ps)
{
+ char buffer[64];
+
if (ps == NULL)
return;
+ snprintf (buffer, 64, "%u:%lu",
+ (unsigned int) curtime,
+ ps->vmem_rss);
+ buffer[63] = '\0';
+ plugin_submit ("ps_rss", ps->name, buffer);
+
DBG ("name = %s; num_proc = %i; num_lwp = %i; vmem_rss = %i; "
"vmem_minflt = %i; vmem_majflt = %i; "
"cpu_user = %i; cpu_system = %i;",
ps->name, ps->num_proc, ps->num_lwp, ps->vmem_rss,
ps->vmem_minflt, ps->vmem_majflt, ps->cpu_user,
ps->cpu_system);
+
}
#if KERNEL_LINUX
void module_register (void)
{
plugin_register (MODULE_NAME, ps_init, ps_read, ps_write);
+ plugin_register ("ps_rss", NULL, NULL, ps_rss_write);
cf_register (MODULE_NAME, ps_config, config_keys, config_keys_num);
}