summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e613c1)
raw | patch | inline | side by side (parent: 4e613c1)
author | Fabien Wernli <cpan@faxm0dem.org> | |
Fri, 9 Dec 2011 15:30:30 +0000 (16:30 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Sat, 21 Jan 2012 10:11:58 +0000 (11:11 +0100) |
Change-Id: I03b188afeb2357e7b8c426bd0c6daff06fda2c4f
Conflicts:
src/memory.c
Conflicts:
src/memory.c
src/memory.c | patch | blob | history |
diff --git a/src/memory.c b/src/memory.c
index d1cd32618094dc73a2c63cbc67cf43f2048b9105..6a50161017bf22e7d384bc597589ad48f97a1e4e 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
long long pp_kernel;
long long physmem;
+ long long availrmem;
if (ksp == NULL)
return (-1);
pp_kernel = get_kstat_value (ksp, "pp_kernel");
physmem = get_kstat_value (ksp, "physmem");
+ availrmem = get_kstat_value (ksp, "availrmem");
if ((mem_used < 0LL) || (mem_free < 0LL) || (mem_lock < 0LL))
+ {
+ WARNING ("memory plugin: one of used, free or locked is negative.");
return (-1);
- if (mem_used < (mem_free + mem_lock))
- return (-1);
+ }
mem_unus = physmem - mem_used;
- mem_used -= mem_free + mem_lock;
+
+ if (mem_used < (mem_free + mem_lock))
+ {
+ /* source: http://wesunsolve.net/bugid/id/4909199
+ * this seems to happen when swap space is small, e.g. 2G on a 32G system
+ * we will make some assumptions here
+ * educated solaris internals help welcome here */
+ DEBUG ("memory plugin: pages total is smaller than \"free\" "
+ "+ \"locked\". This is probably due to small "
+ "swap space");
+ mem_free = availrmem;
+ mem_used = 0;
+ }
+ else
+ {
+ mem_used -= mem_free + mem_lock;
+ }
/* mem_kern is accounted for in mem_lock */
if ( pp_kernel < mem_lock )