blob: 31d16bad0386261046f2486257072e2c0f25b588 [file] [log] [blame]
Jagpal Singh Gill81da1372023-12-15 17:01:03 -08001#pragma once
2
3#include "health_metric_collection.hpp"
4
5#include <unordered_map>
6
7namespace phosphor::health::monitor
8{
9namespace ConfigIntf = phosphor::health::metric::config;
10namespace MetricIntf = phosphor::health::metric;
11namespace CollectionIntf = phosphor::health::metric::collection;
12class 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