Bug 1090483

Summary: Improve sos /proc and /sys data collection
Product: Red Hat Enterprise Linux 6 Reporter: Bryn M. Reeves <bmr>
Component: sosAssignee: Filip Krska <fkrska>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6CC: agk, bmr, bubrown, dkutalek, fkrska, gavin, isenfeld, lmiksik, loberman, mhradile, ovasik, sbradley
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 958179 Environment:
Last Closed: 2017-12-06 11:33:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 958179    
Bug Blocks:    

Description Bryn M. Reeves 2014-04-23 12:31:32 UTC
+++ This bug was initially created as a clone of Bug #958179 +++

Description of problem:
Sosreport currently collects a limited set of files from /proc and /sys. This includes sysctl pseudofiles, module parameters and files relating to certain device types in sysfs.
 
Additional data would be useful to support the analysis of customer problems.
 
The following specific areas of /sys should be included in the report at a minimum. Some are in SOS but most of them are missing. Ideally we would like to gather all of it if possible. See script below.

/sys/block/*
/sys/class/*
/sys/module

/proc/sys/*


Version-Release number of selected component (if applicable):
sos-2.2-*

How reproducible:
100%

Steps to Reproduce:
1. sosreport --batch
2. tar xf <sosreport archive>
3. Inspect sosreport_path/sys/... 
  
Actual results:
Required file entries in /sys and /proc are not present

Expected results:
Need them included

Additional info:

The following script is a script we currently use to achieve the same manually outside of sosreport.


#!/bin/bash
#
# scan-proc-sys.bsh V01.2-32
#*
#*----------------------------------------------------------------------------------------
#*
#* All software provided below is unsupported and provided as-is, without warranty 
#* of any kind.
#*
#* To the extent possible under law, Red Hat, Inc. has dedicated all copyright
#* to this software to the public domain worldwide, pursuant to the CC0 Public
#* Domain Dedication. This software is distributed without any warranty.
#* See <http://creativecommons.org/publicdomain/zero/1.0/>.
#*
#*----------------------------------------------------------------------------------------
#*
#* Maintainer: bubrown
#*
#*----------------------------------------------------------------------------------------
#
#  01/20/2013 loberman 
#  02/01/2013 bubrown   change script slightly to auto-scan anything it finds with specific
#                       exclusions rather than only scanning specific hard coded subdirs.
#
if [ "$1" == "" ]
then
echo " "
echo "missing arguments:"
echo "------------------"
echo "arg1  = temporary staging directory for procfs and sysfs info, e.g. /tmp"
echo " "
exit
fi
#
ODIR=$1
#
_TIME=$(date +%Y%m%d-%H%M%S)
PREFIX=$(hostname)_
#
#
SUFFIX=.proc.fs.tgz
OFILE=$PREFIX$_TIME$SUFFIX
PROCTMP=$ODIR/proc
OLOG=$ODIR/proc/_scan_error.log
#########-#########-#########-#########-#########-#########-
echo "  scan /proc/* ...                      (to $SUFFIX) "
echo "-----------------------------------------------------"
>$OFILE
[[ -d $PROCTMP ]] && rm -rf $PROCTMP    # ensure starting with empty directory
mkdir -p $PROCTMP
uname        >   $PROCTMP/_scan_info.log
echo "==================================="   >> $PROCTMP/_scan_info.log
ls -lR /proc >>  $PROCTMP/_scan_info.log    2>> $PROCTMP/_scan_error.log
echo "==================================="   >> $PROCTMP/_scan_info.log
stash_procfs_entry () {
	echo "cp "$1" -> "$PROCTMP           >> $PROCTMP/_scan_info.log
	echo "- - - - - - - - - - - - - "    >> $PROCTMP/_scan_info.log
	ls -l $1                             >> $PROCTMP/_scan_info.log
        if [[ -d $1 ]]; then
                cp -rpv $1 $PROCTMP 2>>$OLOG >> $PROCTMP/_scan_info.log
        elif [[ -f $1 ]]; then
                cp -pv $1 $PROCTMP 2>>$OLOG  >> $PROCTMP/_scan_info.log
        fi
        echo -n "."                          >> $PROCTMP/_scan_info.log
}
ls -1c /proc >> $PROCTMP/_scan_info.log     2>> $PROCTMP/_scan_error.log
echo "==================================="   >> $PROCTMP/_scan_info.log
#
# Exclusions:
#    . any pid (number) files like /sys/2994
#    . /proc/kmsg (fifo, can "hang" on trying to copy)
#
FILES=/proc/*
for f in $FILES
do
  if expr ${f:6:10} : '-\?[0-9]\+$' >/dev/null
  then
     echo    "file       $f is exception, skipping..."
  else
     if [[ $f = "/proc/kmsg" ]] || [[ $f = "/proc/kcore" ]]
     then
	echo "file       $f is exception, skipping..."
     else
	echo "processing $f..."
        stash_procfs_entry $f
     fi
  fi
done
echo "tar results..."
(cd $ODIR; tar cf - proc 2>>$OLOG)      | gzip -c9 >$OFILE
echo "cleanup "$PROCTMP"..."
rm -rf $PROCTMP
#
# ABG - added 7/15/10 to capture /sys values
SUFFIX=.sys.fs.tgz
OFILE=$PREFIX$_TIME$SUFFIX
SYSTMP=$ODIR/sys
OLOG=$ODIR/sys/_scan_error.log
#########-#########-#########-#########-#########-#########-
echo    " "
echo "  scan /sys/* ...                       (to $SUFFIX) "
echo "-----------------------------------------------------"
>$OFILE
[[ -d $SYSTMP ]] && rm -rf $SYSTMP    # ensure starting with empty directory
mkdir -p $SYSTMP
uname        >   $SYSTMP/_scan_info.log
echo "==================================="  >> $SYSTMP/_scan_info.log
ls -lR /sys  >>  $SYSTMP/_scan_info.log    2>> $SYSTMP/_scan_error.log
echo "==================================="  >> $SYSTMP/_scan_info.log
#
#
# Exclusions:
#    . /sys/kernel has /sys/kernel/debug which includes usbmon debug files
#    which if you try and copy may hang waiting for events to be logged,
#    so skip as a recursive copy and only file copy contents.  This means
#    /sys/kernel/debug and /sys/kernel/security file trees are skipped.
#
stash_sysfs_entry () {
	echo "cp "$1" -> "$SYSTMP           >> $SYSTMP/_scan_info.log
	echo "- - - - - - - - - - - - - "   >> $SYSTMP/_scan_info.log
	ls -l $1                            >> $SYSTMP/_scan_info.log
	if [[ $1 = "/sys/kernel" ]] ; then
	        cp -pv  $1 $SYSTMP 2>>$OLOG >> $SYSTMP/_scan_info.log
	elif [[ -d $1 ]]; then
                cp -rpv $1 $SYSTMP 2>>$OLOG >> $SYSTMP/_scan_info.log
        elif [[ -f $1 ]]; then
                cp -pv  $1 $SYSTMP 2>>$OLOG >> $SYSTMP/_scan_info.log
        fi
        echo -n "."                         >> $SYSTMP/_scan_info.log
}
ls -1c /sys >> $SYSTMP/_scan_info.log      2>> $SYSTMP/_scan_error.log
echo "==================================="  >> $SYSTMP/_scan_info.log
FILES=/sys/*
for f in $FILES
do
  if expr ${f:6:10} : '-\?[0-9]\+$' >/dev/null
  then
     echo "file          $f is exception, skipping..."
  else
     if [[ $f = "/sys/power" ]]
     then
	echo "file       $f is exception, skipping..."
     else
	echo "processing $f..."
        stash_sysfs_entry $f
     fi
  fi
done
echo "tar results..."
(cd $ODIR; tar cf - sys 2>>$OLOG)      | gzip -c9 >$OFILE
echo "cleanup "$SYSTMP"..."
rm -rf $SYSTMP
#
echo " "
echo "results:"
ls -lhtr $PREFIX$_TIME*
echo " "
exit

Comment 10 Jan Kurik 2017-12-06 11:33:46 UTC
Red Hat Enterprise Linux 6 is in the Production 3 Phase. During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:

http://redhat.com/rhel/lifecycle

This issue does not meet the inclusion criteria for the Production 3 Phase and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification. Note that a strong business justification will be required for re-evaluation. Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com/