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/system.cpp b/monitor/system.cpp
index fc38645..050913e 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -507,6 +507,25 @@
     error.commit(ffdc, true);
 
     PowerInterface::executeHardPowerOff();
+
+    createBmcDump();
+}
+
+/**
+ * @brief Create a BMC Dump
+ */
+void System::createBmcDump() const
+{
+    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&)
+    {}
 }
 
 } // namespace phosphor::fan::monitor