dreport: add settings data to BMC dump

Test case1 - busctl success
Wed Apr 27 02:23:56 UTC 2022 INFO: Collected settings
sh-5.1# ls -lah settings.log
-rw-r--r--    1 root     root       46.3K Apr 27 02:23 settings.log
sh-5.1#

Test case2 - busctl failure
Wed Apr 27 04:59:11 UTC 2022 ERROR: Failed to collect settings
Wed Apr 27 04:59:11 UTC 2022 INFO: Copied settings
/var/lib/phosphor-settings-manager/settings
sh-5.1# du -sh settings
16.0K   settings

Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: I2448a3108e0c6c1e6aa1eca49ebf6c76ed4664d9
diff --git a/tools/dreport.d/plugins.d/settings b/tools/dreport.d/plugins.d/settings
new file mode 100644
index 0000000..9a5bc7f
--- /dev/null
+++ b/tools/dreport.d/plugins.d/settings
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+#
+# config: 234 20
+# @brief: Get the settings information.
+#
+
+# shellcheck disable=SC1091
+. "$DREPORT_INCLUDE"/functions
+
+#fetch settings data
+file_name="settings.log"
+
+desc="settings"
+command="busctl call --verbose --no-pager \
+                xyz.openbmc_project.Settings \
+                / \
+                org.freedesktop.DBus.ObjectManager \
+                GetManagedObjects"
+
+#if busctl commands fail capture persistent data
+if ! add_cmd_output "$command" "$file_name" "$desc";
+then
+    settings_dir="/var/lib/phosphor-settings-manager/settings"
+    if [ -d "$settings_dir" ]; then
+        add_copy_file "$settings_dir" "$desc"
+    fi
+fi