monitor: Capture BMC dumps on fan/ambient shutdowns

When fan-monitor or sensor-monitor generates an EPOW, this change
creates a BMC dump after the system is powered off and all error logs
are created.

Change-Id: Iacdd2d2b388e79988e2536d52497f0e697e1d444
Signed-off-by: Mike Capps <mikepcapps@gmail.com>
diff --git a/monitor/power_interface.cpp b/monitor/power_interface.cpp
index 575d2bc..8d9c808 100644
--- a/monitor/power_interface.cpp
+++ b/monitor/power_interface.cpp
@@ -36,6 +36,17 @@
     util::SDBusPlus::callMethod(
         systemdService, systemdPath, systemdMgrIface, "StartUnit",
         "obmc-chassis-hard-poweroff@0.target", "replace");
+
+    try
+    {
+        util::SDBusPlus::callMethod(
+            "xyz.openbmc_project.Dump.Manager", "/xyz/openbmc_project/dump/bmc",
+            "xyz.openbmc_project.Dump.Create", "CreateDump",
+            std::vector<
+                std::pair<std::string, std::variant<std::string, uint64_t>>>());
+    }
+    catch (const sdbusplus::exception::exception&)
+    {}
 }
 
 void PowerInterface::hardPowerOff()