add the meson option for monitor collection freq
Add the meson option for health monitor collection frequency with a
default value of 1s.
Change-Id: I47a87c5b85eebc676239d1d3dcf90037f0bc56b1
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/health_monitor.cpp b/health_monitor.cpp
index 772bdf9..de8b723 100644
--- a/health_monitor.cpp
+++ b/health_monitor.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "health_monitor.hpp"
#include <phosphor-logging/lg2.hpp>
@@ -44,7 +46,8 @@
debug("Reading Health Metric Collection for {TYPE}", "TYPE", type);
collection->read();
}
- co_await sdbusplus::async::sleep_for(ctx, std::chrono::seconds(1));
+ co_await sdbusplus::async::sleep_for(
+ ctx, std::chrono::seconds(MONITOR_COLLECTION_INTERVAL));
}
}
diff --git a/meson.build b/meson.build
index 2c9848f..393f3b6 100644
--- a/meson.build
+++ b/meson.build
@@ -39,6 +39,7 @@
conf_data = configuration_data()
conf_data.set('HEALTH_CONFIG_FILE', '"/etc/healthMon/bmc_health_config.json"')
+conf_data.set('MONITOR_COLLECTION_INTERVAL', get_option('monitor-collection-interval'))
configure_file(output : 'config.h',
configuration : conf_data)
diff --git a/meson.options b/meson.options
index 0fc2767..4d4bc88 100644
--- a/meson.options
+++ b/meson.options
@@ -1 +1,4 @@
option('tests', type: 'feature', description: 'Build tests')
+
+# Variables
+option('monitor-collection-interval', type: 'integer', value: 1, description: 'The health monitor collection interval in seconds.',)