1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

iiab-diagnostics: visually separate 1+6 output sections

This commit is contained in:
A Holt 2019-10-13 12:20:39 -04:00 committed by GitHub
parent 0398bfa7da
commit 29023cb697
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -100,24 +100,33 @@ function cat_tail() { # $1 = path/filename; $2 = # of lines, for tail
# START BUILDING UP THE FILE THAT'LL CONTAIN THE DIAGNOSTICS! # START BUILDING UP THE FILE THAT'LL CONTAIN THE DIAGNOSTICS!
echo -e "\nCompiling diagnostics..." echo -e "\nCompiling diagnostics..."
echo -e "\n 0. Header/Hashes/OS" echo -e "\n 0. Filename Header + Git Hashes + OS"
echo "This is: $outfile" >> $outfile echo "This is: $outfile" >> $outfile
echo >> $outfile echo >> $outfile
echo -e "\n\n\n\n0. GIT HASHES + OS" >> $outfile
echo >> $outfile
echo "iiab commit: $HASH1" >> $outfile echo "iiab commit: $HASH1" >> $outfile
echo "iiab-admin-console commit: $HASH2" >> $outfile echo "iiab-admin-console commit: $HASH2" >> $outfile
echo >> $outfile echo >> $outfile
echo -n "Checking /etc/rpi-issue for Raspbian OS version... " >> $outfile cat_file /etc/issue.net
cat_file /etc/debian_version
#echo "Checking /etc/rpi-issue for Raspbian OS version... " >> $outfile
#echo >> $outfile
cat_file /etc/rpi-issue
echo >> $outfile
if [ -f /etc/rpi-issue ]; then if [ -f /etc/rpi-issue ]; then
echo "stage2 = Raspbian Lite" >> $outfile
echo "stage4 = Raspbian With Desktop" >> $outfile
echo "stage5 = Raspbian With Desktop + Recommended Software" >> $outfile
echo >> $outfile echo >> $outfile
cat /etc/rpi-issue >> $outfile echo "SEE https://github.com/RPi-Distro/pi-gen#stage-anatomy" >> $outfile
echo >> $outfile
echo "stage2 = lite; stage5 = desktop SEE https://github.com/RPi-Distro/pi-gen#stage-anatomy" >> $outfile
else else
echo "Not a Raspberry Pi!" >> $outfile echo "(This is NOT a Raspberry Pi!)" >> $outfile
fi fi
echo >> $outfile echo >> $outfile
echo -e '\n 1. Files specially requested: (for "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n' echo -e '\n\n 1. Files Specially Requested: (for "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n'
echo -e '\n\n\n\n1. FILES SPECIALLY REQUESTED (FOR "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n' >> $outfile
for f in "$@"; do for f in "$@"; do
cat_file $f cat_file $f
done done
@ -127,6 +136,7 @@ if [ $# -eq 0 ]; then
else else
echo -e "\n 2. Regular Files:\n" echo -e "\n 2. Regular Files:\n"
fi fi
echo -e "\n\n\n\n2. REGULAR FILES\n" >> $outfile
#cat_file /dev/sda # Device "file" test #cat_file /dev/sda # Device "file" test
#cat_file /nonsense # Non-existence test #cat_file /nonsense # Non-existence test
#cat_file /opt/iiab/iiab # Directory test #cat_file /opt/iiab/iiab # Directory test
@ -147,7 +157,8 @@ cat_file /etc/network/interfaces
#popd > /dev/null #popd > /dev/null
#cat_file /tmp/all-ansible-vars #cat_file /tmp/all-ansible-vars
echo -e "\n 3. Content of Directories, 1-level deep:\n" echo -e "\n 3. Content of Directories: (1-level deep)\n"
echo -e "\n\n\n\n3. CONTENT OF DIRECTORIES (1-LEVEL DEEP)\n" >> $outfile
cat_dir /etc/network/interfaces.d cat_dir /etc/network/interfaces.d
cat_dir /etc/systemd/network cat_dir /etc/systemd/network
cat_dir /etc/NetworkManager/system-connections cat_dir /etc/NetworkManager/system-connections
@ -156,6 +167,7 @@ cat_dir /etc/netplan
#cat_dir /etc/network # Above file /etc/network/interfaces suffices #cat_dir /etc/network # Above file /etc/network/interfaces suffices
echo -e "\n 4. Output of Commands:\n" echo -e "\n 4. Output of Commands:\n"
echo -e "\n\n\n\n\n4. OUTPUT OF COMMANDS\n" >> $outfile
cat_cmd 'uname -a' 'Linux kernel' cat_cmd 'uname -a' 'Linux kernel'
cat_cmd 'free' 'RAM memory' cat_cmd 'free' 'RAM memory'
cat_cmd 'lscpu' 'CPU details' cat_cmd 'lscpu' 'CPU details'
@ -169,13 +181,16 @@ cat_cmd 'netstat -rn' 'Routing table'
cat_cmd 'sudo netstat -natp' 'Ports/Services in use' cat_cmd 'sudo netstat -natp' 'Ports/Services in use'
cat_cmd 'systemctl status dnsmasq' 'Is dnsmasq Ok?' cat_cmd 'systemctl status dnsmasq' 'Is dnsmasq Ok?'
cat_cmd 'sudo journalctl -u dnsmasq' 'dnsmasq log' cat_cmd 'sudo journalctl -u dnsmasq' 'dnsmasq log'
#cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 24-28 lines above? cat_cmd 'env' 'Environment variables'
#cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above?
echo -e "\n 5. Firewall Rules:\n" echo -e "\n 5. Firewall Rules:\n"
echo -e "\n\n\n\n5. FIREWALL RULES\n" >> $outfile
cat_file /usr/bin/iiab-gen-iptables cat_file /usr/bin/iiab-gen-iptables
cat_cmd 'sudo iptables-save' 'Firewall rules' cat_cmd 'sudo iptables-save' 'Firewall rules'
echo -e "\n 6. Log Files: (last 100 lines of each)\n" echo -e "\n 6. Log Files: (last 100 lines of each)\n"
echo -e "\n\n\n\n6. LOG FILES (LAST 100 LINES OF EACH)\n" >> $outfile
cat_tail /opt/iiab/iiab/iiab-install.log 100 cat_tail /opt/iiab/iiab/iiab-install.log 100
cat_tail /opt/iiab/iiab/iiab-network.log 100 cat_tail /opt/iiab/iiab/iiab-network.log 100
cat_tail /opt/iiab/iiab/iiab-debug.log 100 cat_tail /opt/iiab/iiab/iiab-debug.log 100