1 #pragma once
2 
3 #include "health_metric_collection.hpp"
4 
5 #include <unordered_map>
6 
7 namespace phosphor::health::monitor
8 {
9 namespace ConfigIntf = phosphor::health::metric::config;
10 namespace MetricIntf = phosphor::health::metric;
11 namespace CollectionIntf = phosphor::health::metric::collection;
12 class HealthMonitor
13 {
14   public:
15     HealthMonitor() = delete;
16 
17     HealthMonitor(sdbusplus::bus_t& bus) :
18         bus(bus), configs(ConfigIntf::getHealthMetricConfigs())
19     {
20         create();
21     }
22 
23     /** @brief Run the health monitor */
24     void run();
25 
26   private:
27     using map_t = std::unordered_map<
28         MetricIntf::Type,
29         std::unique_ptr<CollectionIntf::HealthMetricCollection>>;
30     /** @brief Create a new health monitor object */
31     void create();
32     /** @brief D-Bus bus connection */
33     sdbusplus::bus_t& bus;
34     /** @brief Health metric configs */
35     ConfigIntf::HealthMetric::map_t configs;
36     map_t collections;
37 };
38 
39 } // namespace phosphor::health::monitor
40