/**
* collectd - src/processes.c
* Copyright (C) 2005 Lyonel Vincent
+ * Copyright (C) 2006 Florian Forster (Mach code)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
#define MODULE_NAME "processes"
-#if HAVE_THREAD_INFO || defined(KERNEL_LINUX)
+#if HAVE_THREAD_INFO || KERNEL_LINUX
# define PROCESSES_HAVE_READ 1
#else
# define PROCESSES_HAVE_READ 0
blocked) >= BUFSIZE)
return;
+ DBG ("running = %i; sleeping = %i; zombies = %i; stopped = %i; paging = %i; blocked = %i;",
+ running, sleeping, zombies, stopped, paging, blocked);
+
plugin_submit (MODULE_NAME, "-", buf);
}
mach_error_string (status));
}
} /* for (pset_list) */
+
+ ps_submit (running, sleeping, zombies, stopped, -1, blocked);
/* #endif HAVE_THREAD_INFO */
#elif KERNEL_LINUX
if ((fh = fopen (filename, "r")) == NULL)
{
- syslog (LOG_ERR, "Cannot open `%s': %s", filename, strerror (errno));
+ syslog (LOG_NOTICE, "Cannot open `%s': %s", filename,
+ strerror (errno));
continue;
}
if (fgets (buf, BUFSIZE, fh) == NULL)
{
+ syslog (LOG_NOTICE, "Unable to read from `%s': %s",
+ filename, strerror (errno));
fclose (fh);
continue;
}
fclose (fh);
if (strsplit (buf, fields, BUFSIZE) < 3)
+ {
+ DBG ("Line has less than three fields.");
continue;
+ }
switch (fields[2][0])
{
}
}
- closedir(proc);
+ closedir (proc);
ps_submit (running, sleeping, zombies, stopped, paging, blocked);
#endif /* KERNEL_LINUX */