summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>2019-11-05 14:15:51 +0100
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>2019-11-22 17:38:55 +0100
commit3f820f88f067be0e1ddc63e13313361e0f95958e (patch)
treec1c4bb5cae2722da32b9b5329789b576cd01f05e
parent4c455c0ee6c878e2744ab805713085ace2b11124 (diff)
downloadcrash-worker-3f820f88f067be0e1ddc63e13313361e0f95958e.tar.gz
crash-worker-3f820f88f067be0e1ddc63e13313361e0f95958e.tar.bz2
crash-worker-3f820f88f067be0e1ddc63e13313361e0f95958e.zip
dump_systemstate: Dump additional files and applications output
Change-Id: I2c1348a25f7da30c5a177489eb4e57aed5f730ea
-rw-r--r--packaging/crash-worker.spec2
-rwxr-xr-xsrc/dump_systemstate/CMakeLists.txt6
-rw-r--r--src/dump_systemstate/dump_systemstate.c8
-rw-r--r--src/dump_systemstate/files.conf.example6
-rw-r--r--src/dump_systemstate/files/10-crash-worker.conf7
-rw-r--r--src/dump_systemstate/programs.conf.example2
-rw-r--r--src/dump_systemstate/programs/10-crash-worker.conf4
7 files changed, 35 insertions, 0 deletions
diff --git a/packaging/crash-worker.spec b/packaging/crash-worker.spec
index 148e3f4..4a5e9ac 100644
--- a/packaging/crash-worker.spec
+++ b/packaging/crash-worker.spec
@@ -165,7 +165,9 @@ mkdir -p %{buildroot}%{crash_temp}
%attr(0750,crash_worker,crash_worker) %{_bindir}/crash-manager
%attr(0750,crash_worker,crash_worker) %{_bindir}/dump_systemstate
%{_sysconfdir}/dump_systemstate.conf.d/files/files.conf.example
+%{_sysconfdir}/dump_systemstate.conf.d/files/10-crash-worker.conf
%{_sysconfdir}/dump_systemstate.conf.d/programs/programs.conf.example
+%{_sysconfdir}/dump_systemstate.conf.d/programs/10-crash-worker.conf
%{_libexecdir}/crash-stack
%{_libexecdir}/crash-popup-launch
%{_libexecdir}/crash-notify-send
diff --git a/src/dump_systemstate/CMakeLists.txt b/src/dump_systemstate/CMakeLists.txt
index 7c3fa21..d659aa4 100755
--- a/src/dump_systemstate/CMakeLists.txt
+++ b/src/dump_systemstate/CMakeLists.txt
@@ -34,6 +34,12 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin
INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/files.conf.example
DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/files
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/files/10-crash-worker.conf
+ DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/files
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/programs.conf.example
DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/programs
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/programs/10-crash-worker.conf
+ DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/programs
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
diff --git a/src/dump_systemstate/dump_systemstate.c b/src/dump_systemstate/dump_systemstate.c
index 9a0c3ef..46f11f3 100644
--- a/src/dump_systemstate/dump_systemstate.c
+++ b/src/dump_systemstate/dump_systemstate.c
@@ -191,6 +191,14 @@ int main(int argc, char *argv[])
char *du_args[] = {"/bin/du", "-ah", "/opt", "--exclude=/opt/usr", NULL};
spawn_wait_checked(du_args, NULL);
}
+
+ dpercent = get_disk_used_percent("/tmp");
+ if (80 < dpercent) {
+ fprintf_fd(out_fd, "\n==== tmp usage detail - %d%% (/bin/du -h /tmp)\n", dpercent);
+ char *du_args[] = {"/bin/du", "-h", "/tmp", NULL};
+ spawn_wait_checked(du_args, NULL);
+ }
+
fprintf_fd(out_fd, "\n==== System timezone (ls -al /opt/etc/localtime)\n");
char *ls_args[] = {"/bin/ls", "-al", "/opt/etc/localtime", NULL};
spawn_wait_checked(ls_args, NULL);
diff --git a/src/dump_systemstate/files.conf.example b/src/dump_systemstate/files.conf.example
index 92d5f22..e8c73c2 100644
--- a/src/dump_systemstate/files.conf.example
+++ b/src/dump_systemstate/files.conf.example
@@ -1,3 +1,9 @@
+# Please consider prefixing config names with numbers (NN-) if you need order
+# to be preserved.
+#
+# Crash-worker reserves number 00-19 for its purpose. Please add files
+# with number > 20.
+
[UNIQUE_ID_KEY]
title=header line that gets printed (path gets appended too)
path=/path/to/the/file
diff --git a/src/dump_systemstate/files/10-crash-worker.conf b/src/dump_systemstate/files/10-crash-worker.conf
new file mode 100644
index 0000000..6c723e6
--- /dev/null
+++ b/src/dump_systemstate/files/10-crash-worker.conf
@@ -0,0 +1,7 @@
+[VMSTAT]
+title=Virtual Memory statistics
+path=/proc/vmstat
+
+[KERNEL_LOCKS]
+title=Kernel lock
+path=/proc/locks
diff --git a/src/dump_systemstate/programs.conf.example b/src/dump_systemstate/programs.conf.example
index 8e26083..a1782bf 100644
--- a/src/dump_systemstate/programs.conf.example
+++ b/src/dump_systemstate/programs.conf.example
@@ -1,3 +1,5 @@
+# See files.conf.example for note about file naming and ordering.
+
[UNIQUE_ID_KEY]
title=header line describing the program (will be printed alongside env, path and args)
path=/path/to/the/program/executable
diff --git a/src/dump_systemstate/programs/10-crash-worker.conf b/src/dump_systemstate/programs/10-crash-worker.conf
new file mode 100644
index 0000000..67c5f58
--- /dev/null
+++ b/src/dump_systemstate/programs/10-crash-worker.conf
@@ -0,0 +1,4 @@
+[IPC]
+title=System IPC facilities
+path=/usr/bin/ipcs
+args=-a