aboutsummaryrefslogtreecommitdiffstats
path: root/src/extras
diff options
context:
space:
mode:
Diffstat (limited to 'src/extras')
-rwxr-xr-xsrc/extras/sysreport/functions4
-rwxr-xr-xsrc/extras/sysreport/sysreport.legacy93
2 files changed, 58 insertions, 39 deletions
diff --git a/src/extras/sysreport/functions b/src/extras/sysreport/functions
index 74061d18..fff52ccd 100755
--- a/src/extras/sysreport/functions
+++ b/src/extras/sysreport/functions
@@ -48,14 +48,14 @@ getpciinfo() {
catiffile() {
if [ -d $1 ]; then
- /bin/cp -x --parents -R $1 $ROOT 2>>$ROOT/$log
+ /bin/cp -p -x --parents -R $1 $ROOT 2>>$ROOT/$log
find $ROOT/$1 -type b -o -type c | xargs rm -f 2>/dev/null || :
echo -n $STATUS
echo_success
return 1
fi
if [ -f $1 ]; then
- /bin/cp --parents $1 $ROOT 2>>$ROOT/$log
+ /bin/cp -p --parents $1 $ROOT 2>>$ROOT/$log
echo -n $STATUS
echo_success
return 1
diff --git a/src/extras/sysreport/sysreport.legacy b/src/extras/sysreport/sysreport.legacy
index 3ffc1069..043ba026 100755
--- a/src/extras/sysreport/sysreport.legacy
+++ b/src/extras/sysreport/sysreport.legacy
@@ -13,8 +13,8 @@ umask 0077
UTILDIR=/usr/share/sysreport
VER=`/bin/uname -r`
PATH=""
+PROGNAME="sysreport"
DATE=`/bin/date -u +%G%m%d%k%M%S | /usr/bin/tr -d ' '`
-TEMP='/tmp'
function usage {
echo "Sysreport is a utility that gathers information about a system's"
@@ -27,17 +27,24 @@ function usage {
echo " -help : show help"
echo " -norpm : omit collecting information about currently installed packages"
echo " -dmidecode: enable dmidecode, getting information about the hardware"
+ echo " -firewall : collecting the system firewall rules"
+ echo " -home : place sysreport outputs within home directory"
+ echo " -usesysrq : collecting information about sysrq-trigger"
echo
exit 0
}
-[ $# -lt 3 ] || usage
+[ $# -lt 6 ] || usage
for i
do
case "$i" in
-help) usage;;
-norpm) NORPM=yes;;
-dmidecode) DMIDECODE=yes;;
+ -firewall) FIREWALL=yes;;
+ -home) HOMEDIR=yes;;
+ -sysrq) SYSRQ_TRIGGER=yes;;
+ -usesysrq) SYSRQ_TRIGGER=yes;;
*) usage;;
esac
done
@@ -53,8 +60,15 @@ if [ $UID != 0 ]; then
exit 1
fi
-ROOT=$TEMP/sysreport-$DATE
-if ( ! mkdir $ROOT >& /dev/null ) ; then
+if [ "$HOMEDIR" = yes ] ; then
+ TEMPDIR=$HOME
+ ROOT=$HOME/sysreport-$DATE
+ /bin/mkdir $ROOT >& /dev/null
+else
+ TEMPDIR=/tmp
+ ROOT=`/bin/mktemp -dq /tmp/sysreport.XXXXXXXX`
+fi
+if [ $? != 0 ] ; then
echo "Cannot make temp dir"
exit 1
fi
@@ -198,7 +212,7 @@ STATUS="Collecting information about X:"
catiffile "/etc/X11"
STATUS="Gathering sysctl information (/proc/sys):"
-catiffile "/proc/sys"
+catifexec "/sbin/sysctl" "-a"
STATUS="Gathering sysctl information (/etc/sysctl.conf):"
catiffile "/etc/sysctl.conf"
@@ -381,6 +395,9 @@ catiffile "/etc/auto.net"
STATUS="Collecting LVM information:"
catifexec "/usr/sbin/vgdisplay" "-vv"
+STATUS="Gathering LVM setup"
+catiffile "/etc/lvm"
+
STATUS="Collecting SCSI Tape information (/etc/stinit.def)"
catiffile "/etc/stinit.def"
@@ -425,23 +442,25 @@ done
STATUS="Collecting information about ypbind configuration:"
catiffile "/etc/yp.conf"
-KERNELMIN=`/bin/uname -r | /bin/sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`
-ipchainsmod=`/sbin/lsmod 2>/dev/null| /bin/grep ipchains`
-
-if [ "$KERNELMIN" -lt 3 ] || [ -n "${ipchainsmod}" ] ; then
- STATUS="Getting ipchains information:"
- catifexec "/sbin/ipchains" "-nvL"
-elif [ "$KERNELMIN" -gt 3 ]; then
- STATUS="Getting iptables information:"
- if [ -f /etc/sysconfig/iptables-config ] ; then
- catiffile "/etc/sysconfig/iptables-config"
+if [ "$FIREWALL" == "yes" ]; then
+ KERNELMIN=`/bin/uname -r | /bin/sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`
+ ipchainsmod=`/sbin/lsmod 2>/dev/null| /bin/grep ipchains`
+
+ if [ "$KERNELMIN" -lt 3 ] || [ -n "${ipchainsmod}" ] ; then
+ STATUS="Getting ipchains information:"
+ catifexec "/sbin/ipchains" "-nvL"
+ elif [ "$KERNELMIN" -gt 3 ]; then
+ STATUS="Getting iptables information:"
+ if [ -f /etc/sysconfig/iptables-config ] ; then
+ catiffile "/etc/sysconfig/iptables-config"
+ fi
+ STATUS="Getting iptables information (filter):"
+ catifexec "/sbin/iptables" "-t filter -nvL"
+ STATUS="Getting iptables information (mangle):"
+ catifexec "/sbin/iptables" "-t mangle -nvL"
+ STATUS="Getting iptables information (nat):"
+ catifexec "/sbin/iptables" "-t nat -nvL"
fi
- STATUS="Getting iptables information (filter):"
- catifexec "/sbin/iptables" "-t filter -nvL"
- STATUS="Getting iptables information (mangle):"
- catifexec "/sbin/iptables" "-t mangle -nvL"
- STATUS="Getting iptables information (nat):"
- catifexec "/sbin/iptables" "-t nat -nvL"
fi
# ldap client and server config
@@ -584,23 +603,22 @@ for x in `/bin/ls -d /etc/cups/*.conf 2>/dev/null` ; do
catiffile "$x"
done
-STATUS="Getting information about printcap"
-catiffile "/etc/printcap"
-
echo
echo "Gathering information from system logs"
echo
STATUS="Collecting information from dmesg:"
catiffile "/var/log/dmesg"
-STATUS="Collecting information from /proc/sysrq-trigger"
-if [ -f /proc/sysrq-trigger -a -f /proc/sys/kernel/sysrq ] ; then
- sysr_state="$(/bin/cat /proc/sys/kernel/sysrq)"
- echo 1 > /proc/sys/kernel/sysrq
- for key in m p t ; do
- echo $key > /proc/sysrq-trigger
- done
- echo $sysr_state > /proc/sys/kernel/sysrq
+if [ "$SYSRQ_TRIGGER" == "yes" ]; then
+ STATUS="Collecting information from /proc/sysrq-trigger"
+ if [ -f /proc/sysrq-trigger -a -f /proc/sys/kernel/sysrq ] ; then
+ sysr_state="$(/bin/cat /proc/sys/kernel/sysrq)"
+ echo 1 > /proc/sys/kernel/sysrq
+ for key in m p t ; do
+ echo $key > /proc/sysrq-trigger
+ done
+ echo $sysr_state > /proc/sys/kernel/sysrq
+ fi
fi
for x in `/bin/ls /var/log/messages*` ; do
@@ -684,6 +702,7 @@ if [ -f $RHNDIR/systemid ] ; then
catiffile "$RHNDIR/systemid"
fi
fi
+
# Get hardware profile information (for verification with system state and RHN)
if [ -x /usr/share/rhn/up2date_client/hardware.py ] ; then
STATUS="Gathering RHN hardware profile information"
@@ -698,6 +717,7 @@ if [ -x /usr/bin/rhn-charsets ] ; then
catifexec "/usr/bin/rhn-charsets"
fi
+# Get SELinux information
echo
echo "Gathering information on SELinux setup"
echo
@@ -706,9 +726,8 @@ catifexec "/usr/sbin/sestatus"
catifexec "rpm" "-q -V selinux-policy-targeted"
catifexec "rpm" "-q -V selinux-policy-strict"
-cd $TEMP
+cd $TEMPDIR
/bin/echo
-HOSTNM=`hostname -s`
/bin/echo -n "Please enter your case number (if you have one): "
while read CASENUM
@@ -723,9 +742,9 @@ do
esac
done
if [ ! $CASENUM ]; then
- NAME=$HOSTNM.$DATE
+ NAME=$PROGNAME-$HOSTNAME.$DATE
else
- NAME="$HOSTNM-$CASENUM.$DATE"
+ NAME="$PROGNAME-$HOSTNAME-$CASENUM.$DATE"
fi
/bin/rm -Rf $NAME
/bin/mv $ROOT $NAME
@@ -740,7 +759,7 @@ fi
/bin/rm -Rf $NAME
/bin/echo
-/bin/echo "Please send $TEMP/${NAME}.${SUFFIX} to your support"
+/bin/echo "Please send $TEMPDIR/${NAME}.${SUFFIX} to your support"
/bin/echo "representative."
/bin/echo