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

Merge pull request #2330 from holta/iiab-diagnostics-3

Enhance iiab-diagnostics command
This commit is contained in:
A Holt 2020-04-09 12:25:00 -04:00 committed by GitHub
commit c34a8b1427
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

View file

@ -87,7 +87,11 @@ function cat_cmd() { # $1 = command + params, $2 = explan
pth=$(which $cmd | sed 's/[^/]*$//') # Keep only path on left; Drop command on right pth=$(which $cmd | sed 's/[^/]*$//') # Keep only path on left; Drop command on right
echo "COMMAND: $pth$1 # $2" >> $outfile echo "COMMAND: $pth$1 # $2" >> $outfile
echo >> $outfile echo >> $outfile
$(echo $1) >> $outfile if [ -z "$pth" ]; then
echo "COMMAND NOT FOUND: $1" >> $outfile
else
$(echo "eval $1") >> $outfile # eval is nec within backticks, so | (pipes) work: https://stackoverflow.com/a/7184782
fi
echo >> $outfile echo >> $outfile
} }
@ -119,7 +123,7 @@ if [ -f /etc/rpi-issue ]; then
echo >> $outfile echo >> $outfile
echo "SEE https://github.com/RPi-Distro/pi-gen#stage-anatomy" >> $outfile echo "SEE https://github.com/RPi-Distro/pi-gen#stage-anatomy" >> $outfile
else else
echo "(This is NOT a Raspberry Pi!)" >> $outfile echo "(This is NOT Raspbian!)" >> $outfile
fi fi
echo >> $outfile echo >> $outfile
cat_file /etc/issue.net cat_file /etc/issue.net
@ -151,6 +155,8 @@ cat_file /etc/iiab/iiab_state.yml
cat_file /etc/iiab/config_vars.yml cat_file /etc/iiab/config_vars.yml
cat_file /etc/resolv.conf cat_file /etc/resolv.conf
cat_file /etc/network/interfaces cat_file /etc/network/interfaces
cat_file /etc/hostapd/hostapd.conf # Auto-redact password?
#cat_file /etc/wpa_supplicant/wpa_supplicant.conf # Auto-redact password?
# Record all Ansible variables: SLOW! OUTPUT TOO LARGE? # Record all Ansible variables: SLOW! OUTPUT TOO LARGE?
#pushd /opt/iiab/iiab > /dev/null #pushd /opt/iiab/iiab > /dev/null
@ -177,11 +183,19 @@ cat_cmd 'lsblk' 'Partition mount points'
cat_cmd 'blkid' 'Mount point details' cat_cmd 'blkid' 'Mount point details'
cat_cmd 'ip addr' 'Network interfaces' cat_cmd 'ip addr' 'Network interfaces'
cat_cmd 'ifconfig' 'Network interfaces (old view)' cat_cmd 'ifconfig' 'Network interfaces (old view)'
cat_cmd 'ip route' 'Routing table'
cat_cmd 'netstat -rn' 'Routing table (old view)'
cat_cmd 'brctl show' 'Bridge for LAN side' cat_cmd 'brctl show' 'Bridge for LAN side'
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 -b 0 -u dnsmasq' 'dnsmasq log'
cat_cmd 'networkctl' 'systemd-networkd status'
cat_cmd 'nmcli d' 'NetworkManager status'
cat_cmd 'sudo journalctl -b 0 -u networkd-dispatcher' 'networkd-dispatcher log'
cat_cmd 'iw dev' 'List wireless interfaces'
cat_cmd 'systemctl status hostapd' 'Is hostapd Ok?'
cat_cmd 'ps -AH' 'Process hierarchy: staging of hostapd & wpa_supplicant?'
cat_cmd 'dmesg | grep brcm' 'Diagnostic messages: RPi WiFi firmware'
cat_cmd 'env' 'Environment variables' 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? #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?
@ -196,6 +210,8 @@ 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
cat_tail /opt/iiab/iiab-admin-console/admin-install.log 100 cat_tail /opt/iiab/iiab-admin-console/admin-install.log 100
cat_tail /var/log/messages 100
cat_tail /var/log/syslog 100
linecount=$(wc -l $outfile | sed 's/\s.*$//') linecount=$(wc -l $outfile | sed 's/\s.*$//')
sizecount=$(du -h $outfile | sed 's/\s.*$//') sizecount=$(du -h $outfile | sed 's/\s.*$//')

View file

@ -60,4 +60,4 @@ But first off, the file is compiled by harvesting 1 + 6 kinds of things:
## Source Code ## Source Code
Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 100-198 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible. Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 104-214 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible.