enable health_monitor new implementation
Add health_monitor interface and implementation. Enable the
health_monitor from existing healthMonitor flow.
This change is in relation to following design and D-Bus interface
update -
https://gerrit.openbmc.org/c/openbmc/docs/+/64917
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/64914
Tested:
```
busctl tree xyz.openbmc_project.HealthMon
`- /xyz
`- /xyz/openbmc_project
`- /xyz/openbmc_project/metric
`- /xyz/openbmc_project/metric/bmc
|- /xyz/openbmc_project/metric/bmc/cpu
| |- /xyz/openbmc_project/metric/bmc/cpu/kernel
| |- /xyz/openbmc_project/metric/bmc/cpu/total
| `- /xyz/openbmc_project/metric/bmc/cpu/user
|- /xyz/openbmc_project/metric/bmc/memory
| |- /xyz/openbmc_project/metric/bmc/memory/available
| |- /xyz/openbmc_project/metric/bmc/memory/buffered_and_cached
| |- /xyz/openbmc_project/metric/bmc/memory/free
| |- /xyz/openbmc_project/metric/bmc/memory/shared
| `- /xyz/openbmc_project/metric/bmc/memory/total
`- /xyz/openbmc_project/metric/bmc/storage
|- /xyz/openbmc_project/metric/bmc/storage/rw
`- /xyz/openbmc_project/metric/bmc/storage/tmp
curl -k https://localhost:8443/redfish/v1/Managers/bmc/ManagerDiagnosticData
--user "root:0penBmc"
{
"@odata.id": "/redfish/v1/Managers/bmc/ManagerDiagnosticData",
"@odata.type": "#ManagerDiagnosticData.v1_2_0.ManagerDiagnosticData",
"FreeStorageSpaceKiB": 3,
"Id": "ManagerDiagnosticData",
"MemoryStatistics": {
"AvailableBytes": 354029533,
"BuffersAndCacheBytes": 79077333,
"FreeBytes": 291730033,
"SharedBytes": 11876000,
"TotalBytes": 425516000
},
"Name": "Manager Diagnostic Data",
"ProcessorStatistics": {
"KernelPercent": 16.1534,
"UserPercent": 10.6638
},
"ServiceRootUptimeSeconds": 834.753
}
```
Change-Id: I1e9fac226b438f0556cb20321f1f2b6d51af7dbc
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/health_utils.cpp b/health_utils.cpp
index 163fc8c..a60db8b 100644
--- a/health_utils.cpp
+++ b/health_utils.cpp
@@ -20,4 +20,29 @@
bus.call_noreply(msg);
}
+auto findPaths(sdbusplus::bus_t& bus, const std::string& iface) -> paths_t
+{
+ sdbusplus::message_t msg = bus.new_method_call(
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths");
+ const char* inventoryPath = "/xyz/openbmc_project/inventory";
+
+ msg.append("/", 0, std::vector<std::string>{iface});
+
+ try
+ {
+ auto paths = bus.call(msg, int32_t(0)).unpack<paths_t>();
+ debug("Found {COUNT} paths for {IFACE}", "COUNT", paths.size(), "IFACE",
+ iface);
+ return paths;
+ }
+ catch (std::exception& e)
+ {
+ error("Exception occurred for GetSubTreePaths for {PATH}: {ERROR}",
+ "PATH", inventoryPath, "ERROR", e);
+ }
+ return {};
+}
+
} // namespace phosphor::health::utils