Subject: [PATCH] [BZ 168517] dbginfo.sh: Extend data collection
From: Sa Liu <saliu@de.ibm.com>

Description:    dbginfo.sh: Extend data collection 
Symptom:        This update covers various symptoms on dbginfo.sh data
                collection:
                - There is no data collected for docker.
                - ps command does not show threads infomation.
                - There is no run queue statistics and scheduler data. 
                - z/VM commands do not show multithread, protect
                  settings and SSI status.
Problem:        Following problems exist:
                - No analysis is possible for docker data.
                - Missing thread information.
                - Missing run queue statistics and scheduler data.
                - Missing z/VM information.
Solution:       - Extend the data collection to collect docker data
                - Change ps command to show threads informaton
                - Add commands to display run queue statistics and 
                  scheduler data.
                - Add z/VM commands to show multithread, protect settings
                  and SSI status.
Reproduction: Run this script and verify the output
Upstream-ID:  -
Problem-ID:   168517

Signed-off-by: Sa Liu <saliu@de.ibm.com>
---
 scripts/dbginfo.sh   |   49 ++++++++++++++++++++++++++++++-------------------
 scripts/dbginfo.sh.1 |   27 +++++++++++++++------------
 2 files changed, 45 insertions(+), 31 deletions(-)

--- a/scripts/dbginfo.sh
+++ b/scripts/dbginfo.sh
@@ -2,7 +2,7 @@
 #
 # dbginfo.sh - Tool to collect runtime, configuration, and trace information
 #
-# Copyright IBM Corp. 2002, 2017
+# Copyright IBM Corp. 2002, 2018
 #
 
 # Switching to neutral locale
@@ -18,7 +18,7 @@ readonly SCRIPTNAME="${0##*/}"
 print_version() {
     cat <<EOF
 ${SCRIPTNAME}: Debug information script version %S390_TOOLS_VERSION%
-Copyright IBM Corp. 2002, 2017
+Copyright IBM Corp. 2002, 2018
 EOF
 }
 
@@ -115,27 +115,26 @@ fi
 ########################################
 # Global used variables
 #
-
 # The base working directory
 readonly WORKDIR_BASE="$(echo "${paramWORKDIR_BASE}" | sed -e 's#/$##')/"
 
 # The terminal
-readonly TERMINAL=$(tty 2>/dev/null)
+readonly TERMINAL="$(tty 2>/dev/null)"
 
 # The hostname of the system
-readonly SYSTEMHOSTNAME=$(hostname -s 2>/dev/null)
+readonly SYSTEMHOSTNAME="$(hostname -s 2>/dev/null)"
 
 # The kernel release version as delivered from uname -r
-readonly KERNEL_RELEASE_VERSION=$(uname -r 2>/dev/null)
+readonly KERNEL_RELEASE_VERSION="$(uname -r 2>/dev/null)"
 
 # The processor ID for the first processor
-readonly PROCESSORID=$(grep -E ".*processor 0:.*" /proc/cpuinfo | sed 's/.*identification[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')
-
+readonly PROCESSORID="$(grep -E ".*processor 0:.*" /proc/cpuinfo | \
+                      sed 's/.*identification[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')"
 # The processor version for the first processor
-readonly PROCESSORVERSION=$(grep -E ".*processor 0:.*" /proc/cpuinfo | sed 's/.*version[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')
-
+readonly PROCESSORVERSION="$(grep -E ".*processor 0:.*" /proc/cpuinfo | \
+                      sed 's/.*version[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')"
 # The current date
-readonly DATETIME=$(date +%Y-%m-%d-%H-%M-%S 2>/dev/null)
+readonly DATETIME="$(date +%Y-%m-%d-%H-%M-%S 2>/dev/null)"
 
 # The current working directory for the actual script execution
 if test -z "${PROCESSORID}"; then
@@ -247,6 +246,8 @@ PROCFILES="\
   /proc/qeth\
   /proc/qeth_perf\
   /proc/qeth_ipa_takeover\
+  /proc/sched_debug\
+  /proc/schedstat\
   /proc/service_levels\
   /proc/slabinfo\
   /proc/stat\
@@ -300,6 +301,7 @@ LOGFILES="\
   /var/log/lin_tape.trace\
   /var/log/lin_tape.errorlog\
   /var/log/messages*\
+  /var/log/syslog*\
   /var/log/sa\
   /var/log/yum.log\
   /var/log/openvswitch/ovs-vswitchd.log\
@@ -348,6 +350,7 @@ CONFIGFILES="\
   /etc/resolv.*\
   /etc/rsyslog.d\
   /etc/ssl/openssl.conf\
+  /etc/ssl/openssl.cnf\
   /etc/sysconfig\
   /etc/sysctl.d\
   /etc/syslog*\
@@ -357,7 +360,8 @@ CONFIGFILES="\
   /etc/*release\
   $(find /lib/modules -name modules.dep 2>/dev/null)\
   /etc/docker\
-  /usr/lib/systemd\
+  /lib/systemd/system/docker.service\
+  /usr/lib/systemd/system/docker.service\
   /etc/apparmor.d\
   "
 
@@ -368,7 +372,8 @@ CMDS="uname -a\
   :runlevel\
   :iptables -L\
   :ulimit -a\
-  :ps -eo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\
+  :ps -emo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\
+  :ps -eHo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\
   :ps axX\
   :dmesg -s 1048576\
   :last\
@@ -433,13 +438,16 @@ CMDS="uname -a\
   :lsof\
   :mount\
   :df -h\
+  :df -i\
   :pvpath -qa\
   :find /boot -print0 | sort -z | xargs -0 -n 10 ls -ld\
   :find /dev -print0 | sort -z | xargs -0 -n 10 ls -ld\
   :java -version\
   :cat /root/.bash_history\
   :env\
-  :journalctl --all --no-pager --since=$(date -d '5 day ago' +%Y-%m-%d) --until=now --lines=50000 > ${OUTPUT_FILE_JOURNALCTL}\
+  :journalctl --all --no-pager --since=$(date -d '5 day ago' +%Y-%m-%d) --until=now --lines=50000 \
+   > '${OUTPUT_FILE_JOURNALCTL}'\
+  :openssl engine\
   :systemd-delta\
   :systemctl --all --no-pager show\
   :systemctl --all --no-pager list-units\
@@ -447,13 +455,10 @@ CMDS="uname -a\
   :docker info\
   :docker images\
   :docker network ls\
-  :docker ps\
   :docker ps -a\
-  :docker stats --no-stream\
   :docker version\
+  :docker stats --no-stream\
   :systemctl status docker.service\
-  :df /var/lib/docker\
-  :df --inodes /var/lib/docker\
   "
 
 ########################################
@@ -462,6 +467,10 @@ VM_CMDS="q userid\
   :q users\
   :q privclass\
   :q cplevel\
+  :q cpservice\
+  :q cpprot user\
+  :q specex\
+  :q ssi\
   :q cpus\
   :q srm\
   :q vtod\
@@ -500,6 +509,8 @@ VM_CMDS="q userid\
   :q nic\
   :q pav\
   :q proc\
+  :q proc topology\
+  :q mt\
   :q qioass\
   :q spaces\
   :q swch all\
@@ -821,7 +832,7 @@ post_processing() {
     local tmp_file
     local file_name
 
-    pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Postprocessing"
+    pr_syslog_stdout "${COLLECTION_COUNT} of ${COLLECTION_COUNT}: Postprocessing"
 
     find "${WORKPATH}etc/libvirt/qemu/" -maxdepth 1 -name "*.xml" 2>/dev/null | while IFS= read -r file_name; do
 	file_mtime_epoche=$(stat --format=%Y "${file_name}")
--- a/scripts/dbginfo.sh.1
+++ b/scripts/dbginfo.sh.1
@@ -1,4 +1,4 @@
-.TH DBGINFO.SH  1 "February 2015" "s390-tools"
+.TH DBGINFO.SH  1 "June 2018" "s390-tools"
 
 .SH NAME
 dbginfo.sh \- collect runtime, configuration and trace information
@@ -52,7 +52,7 @@ Sample invocation:
 .br
 dbginfo.sh: Debug information script version %S390_TOOLS_VERSION%
 .br
-Copyright IBM Corp. 2002, 2016
+Copyright IBM Corp. 2002, 2018
 .PP
 Hardware platform     = s390x
 .br
@@ -60,25 +60,28 @@ Kernel version        = <kernel\-version
 .br
 Runtime environment   = z/VM
 .PP
-1 of 10: Collecting command output
+1 of 11: Collecting command output
 .PP
-2 of 10: Collecting z/VM command output
+2 of 11: Collecting z/VM command output
 .PP
-3 of 10: Collecting procfs
+3 of 11: Collecting procfs
 .PP
-4 of 10: Collecting sysfs
+4 of 11: Collecting sysfs
 .PP
-5 of 10: Collecting log files
+5 of 11: Collecting log files
 .PP
-6 of 10: Collecting config files
+6 of 11: Collecting config files
 .PP
-7 of 10: Collecting osa oat output skipped \- not available
+7 of 11: Collecting osa oat output skipped \- not available
 .PP
-8 of 10: Collecting OpenVSwitch output
+8 of 11: Collecting OpenVSwitch output
 .PP
-9 of 10: Collecting domain xml files
+9 of 11: Collecting domain xml files
 .PP
-10 of 10: Postprocessing
+10a of 11: Collecting docker container output
+10b of 11: Collecting docker network output
+.PP
+11 of 11: Postprocessing
 .PP
 Finalizing: Creating archive with collected data
 .PP
