summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ebdc901)
raw | patch | inline | side by side (parent: ebdc901)
author | Oleg King <king2@kaluga.ru> | |
Mon, 5 May 2008 12:21:37 +0000 (14:21 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Mon, 5 May 2008 12:21:37 +0000 (14:21 +0200) |
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/users.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index e95f99d63e48a34ab402962120aea4443779c281..7477f4191ea3552c61f242613791ba72d663192c 100644 (file)
--- a/configure.in
+++ b/configure.in
plugin_load="yes"
plugin_memory="yes"
plugin_swap="yes"
+ plugin_users="yes"
fi
if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
diff --git a/src/Makefile.am b/src/Makefile.am
index 88041b9913e5819d14981e951c1b0097a387fee3..2618ba9e04ddda5f81789e51ef126d63aaff356c 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
pkglib_LTLIBRARIES += users.la
users_la_SOURCES = users.c
users_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBSTATGRAB
+users_la_CFLAGS = $(BUILD_WITH_LIBSTATGRAB_CFLAGS)
+users_la_LIBADD = $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
+endif
collectd_LDADD += "-dlopen" users.la
collectd_DEPENDENCIES += users.la
endif
diff --git a/src/users.c b/src/users.c
index afe26e1e27fc27a3d155b135b56d3571290bcd46..4686443e4b25e3d31391bcf0d3a049aa2482c406 100644 (file)
--- a/src/users.c
+++ b/src/users.c
#include "common.h"
#include "plugin.h"
+#if HAVE_STATGRAB_H
+# include <statgrab.h>
+#endif /* HAVE_STATGRAB_H */
+
#if HAVE_UTMPX_H
# include <utmpx.h>
/* #endif HAVE_UTMPX_H */
users_submit (users);
/* #endif HAVE_GETUTENT */
+#elif HAVE_LIBSTATGRAB
+ sg_user_stats *us;
+
+ us = sg_get_user_stats ();
+ if (us == NULL)
+ return (-1);
+
+ users_submit ((gauge_t) us->num_entries);
+/* #endif HAVE_LIBSTATGRAB */
+
#else
# error "No applicable input method."
#endif