PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/sharedrads/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //opt/sharedrads/postmortem

#!/bin/bash
# Automate the gathering of relevant information for diagnosis of QOS event

# Confirm root privs
if [[ "${UID}" -ne "0" ]]
then
    echo "This script requires root privilege please elevate and try again"
    exit 1
fi

# Set some Variables
LOGPATH=/var/log/postmortem
EVENTDATE=$(date -Ihours)
MLOGDATE=$(date +'%b %-d')
# MLOGHSTART=$(date --date='10 minutes ago' +%I)
# MLOGHEND=$(date +%I)

# if [[ "${MLOGHSTART}" -eq "${MLOGHEND}" ]]
# then
#     MHOUR="${MLOGHEND}"
# else
#     MHOUR="'$MLOGHSTART|$MLOGHEND'"
# fi

# Confirm directory exists and create timestamped log file
if [[ ! -d "$LOGPATH" ]]
then
    mkdir $LOGPATH
fi

echo "=== PostMortem $HOSTNAME $EVENTDATE ===" > $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE

# Log sar data for RAM and CPU usage leading up to event
echo "Sar CPU Output" >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE
sar -q | tail -50 >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE
echo "Sar RAM Output" >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE
sar -r | tail -50 >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE

# Gather Kernel events logged for the period leading up to reboot
echo "Kernel events for past hour from message log" >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE
grep kernel /var/log/messages | grep  -E "'$MLOGDATE'" | tail -50 >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE

# Check for earlyoom logs
echo "Earlyoom output" >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE
grep earlyoom /var/log/messages | grep  -E "'$MLOGDATE'" | tail -50 >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE

# Log info from RADS (check_user and recent-cp)
echo "RADS output"  >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE
/opt/sharedrads/check_user >> $LOGPATH/postmortem-$EVENTDATE
echo  >> $LOGPATH/postmortem-$EVENTDATE
/opt/sharedrads/recent-cp  >> $LOGPATH/postmortem-$EVENTDATE