Signed-off-by: Jan Friesse <[email protected]>
---
 configure.ac |    3 +++
 exec/mon.c   |   14 ++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 523d2cf..4f374fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -428,6 +428,9 @@ fi
 
 if test "x${enable_monitoring}" = xyes; then
        PKG_CHECK_MODULES([statgrab], [libstatgrab])
+       PKG_CHECK_MODULES([statgrabge090], [libstatgrab >= 0.90],
+           AC_DEFINE_UNQUOTED([HAVE_LIBSTATGRAB_GE_090], 1, [have libstatgrab 
>= 0.90]),
+           TMP_VARIABLE=1)
        AC_DEFINE_UNQUOTED([HAVE_MONITORING], 1, [have resource monitoring])
        PACKAGE_FEATURES="$PACKAGE_FEATURES monitoring"
        WITH_LIST="$WITH_LIST --with monitoring"
diff --git a/exec/mon.c b/exec/mon.c
index 49c46b4..ab16a47 100644
--- a/exec/mon.c
+++ b/exec/mon.c
@@ -307,8 +307,13 @@ static int32_t percent_mem_used_get(void)
        sg_swap_stats *swap_stats;
        long long total, freemem;
 
+#ifdef HAVE_LIBSTATGRAB_GE_090
+       mem_stats = sg_get_mem_stats(NULL);
+       swap_stats = sg_get_swap_stats(NULL);
+#else
        mem_stats = sg_get_mem_stats();
        swap_stats = sg_get_swap_stats();
+#endif
 
        if (mem_stats == NULL || swap_stats != NULL) {
                log_printf (LOGSYS_LEVEL_ERROR, "Unable to get memory stats: 
%s",
@@ -348,7 +353,12 @@ static void mem_update_stats_fn (void *data)
 static double min15_loadavg_get(void)
 {
        sg_load_stats *load_stats;
+
+#ifdef HAVE_LIBSTATGRAB_GE_090
+       load_stats = sg_get_load_stats (NULL);
+#else
        load_stats = sg_get_load_stats ();
+#endif
        if (load_stats == NULL) {
                log_printf (LOGSYS_LEVEL_ERROR, "Unable to get load stats: %s",
                        sg_str_error (sg_get_error()));
@@ -463,7 +473,11 @@ static void mon_instance_init (struct resource_instance* 
inst)
 
 static char *mon_exec_init_fn (struct corosync_api_v1 *corosync_api)
 {
+#ifdef HAVE_LIBSTATGRAB_GE_090
+       sg_init(1);
+#else
        sg_init();
+#endif
 
        api = corosync_api;
 
-- 
1.7.1

_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss

Reply via email to