summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9ac2838)
raw | patch | inline | side by side (parent: 9ac2838)
author | Florian Forster <octo@noris.net> | |
Mon, 5 May 2008 12:03:41 +0000 (14:03 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Mon, 5 May 2008 12:03:41 +0000 (14:03 +0200) |
src/cpu.c | patch | blob | history |
diff --git a/src/cpu.c b/src/cpu.c
index 2165ce64e7f1182af8bc77467bafbcd499d20af5..7692e2b56fdb0423689450ba2d6702fe224a509f 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
#elif defined(HAVE_LIBSTATGRAB)
sg_cpu_stats *cs;
- if ((cs = sg_get_cpu_stats ()) == NULL)
- return (0);
-
- submit (0, "idle", (counter_t) cs->idle);
- submit (0, "nice", (counter_t) cs->nice);
- submit (0, "user", (counter_t) cs->user);
- submit (0, "system", (counter_t) (cs->kernel+cs->swap+cs->iowait));
+ cs = sg_get_cpu_stats ();
+
+ if (cs == NULL)
+ {
+ ERROR ("cpu plugin: sg_get_cpu_stats failed.");
+ return (-1);
+ }
+
+ submit (0, "idle", (counter_t) cs->idle);
+ submit (0, "nice", (counter_t) cs->nice);
+ submit (0, "swap", (counter_t) cs->swap);
+ submit (0, "system", (counter_t) cs->kernel);
+ submit (0, "user", (counter_t) cs->user);
+ submit (0, "wait", (counter_t) cs->iowait);
#endif /* HAVE_LIBSTATGRAB */
return (0);