dreport: Added pldmflightrecorder plugin

Plugin used for collecting pldm flight recorder

Tested: verified using dreport

Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Change-Id: I49f5a06507593fc6dc07a2ae3d0e36891d176dfc
diff --git a/tools/dreport.d/plugins.d/pldmflightrecorder b/tools/dreport.d/plugins.d/pldmflightrecorder
new file mode 100644
index 0000000..5b9b094
--- /dev/null
+++ b/tools/dreport.d/plugins.d/pldmflightrecorder
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# config: 2 20
+# @brief: Get the pldm flight recorder
+#
+
+. $DREPORT_INCLUDE/functions
+
+desc="pldm flight recorder"
+
+# collect data only if pldmd is enabled
+if [ -e "/usr/bin/pldmd" ]; then
+  command="rm -rf /tmp/pldm_flight_recorder; killall -s SIGUSR1 pldmd; \
+           sleep 5; cat /tmp/pldm_flight_recorder"
+
+  file_name="pldmflightrecorder.log"
+
+  add_cmd_output "$command" "$file_name" "$desc"
+
+  rm -rf /tmp/pldm_flight_recorder
+else
+  log_warning "skipping pldm flight recorder:  pldmd is not enabled"
+fi