Removed old HW script wrappers
This commit is contained in:
parent
8e5bfa12f4
commit
e623185d96
9 changed files with 75 additions and 272 deletions
39
scripts/hw-drive-info
Executable file
39
scripts/hw-drive-info
Executable file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
|
||||||
|
BLUE='\033[34m'
|
||||||
|
CLEAR='\033[0m'
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
# List devices
|
||||||
|
for line in $(lsblk -do NAME,TRAN,SIZE,VENDOR,MODEL,SERIAL); do
|
||||||
|
if [[ "${line:0:4}" == "NAME" ]]; then
|
||||||
|
echo -e "${BLUE}${line}${CLEAR}"
|
||||||
|
else
|
||||||
|
echo "${line}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# List loopback devices
|
||||||
|
if [[ "$(losetup -l | wc -l)" > 0 ]]; then
|
||||||
|
for line in $(losetup -lO NAME,PARTSCAN,RO,BACK-FILE); do
|
||||||
|
if [[ "${line:0:4}" == "NAME" ]]; then
|
||||||
|
echo -e "${BLUE}${line}${CLEAR}"
|
||||||
|
else
|
||||||
|
echo "${line}" | sed -r 's#/dev/(loop[0-9]+)#\1 #'
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# List partitions
|
||||||
|
for line in $(lsblk -o NAME,SIZE,FSTYPE,LABEL,MOUNTPOINT); do
|
||||||
|
if [[ "${line:0:4}" == "NAME" ]]; then
|
||||||
|
echo -e "${BLUE}${line}${CLEAR}"
|
||||||
|
else
|
||||||
|
echo "${line}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
@ -9,20 +9,20 @@ YELLOW="\e[33m"
|
||||||
BLUE="\e[34m"
|
BLUE="\e[34m"
|
||||||
|
|
||||||
function print_in_columns() {
|
function print_in_columns() {
|
||||||
string="$1"
|
string="$1"
|
||||||
label="$(echo "$string" | sed -r 's/^\s*(.*:).*/\1/')"
|
label="$(echo "$string" | sed -r 's/^\s*(.*:).*/\1/')"
|
||||||
value="$(echo "$string" | sed -r 's/^\s*.*:\s*(.*)/\1/')"
|
value="$(echo "$string" | sed -r 's/^\s*.*:\s*(.*)/\1/')"
|
||||||
printf ' %-18s%s\n' "$label" "$value"
|
printf ' %-18s%s\n' "$label" "$value"
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_dmi_value() {
|
function print_dmi_value() {
|
||||||
name="$1"
|
name="$1"
|
||||||
file="/sys/devices/virtual/dmi/id/$2"
|
file="/sys/devices/virtual/dmi/id/$2"
|
||||||
value="UNKNOWN"
|
value="UNKNOWN"
|
||||||
if [[ -e "$file" ]]; then
|
if [[ -e "$file" ]]; then
|
||||||
value="$(cat "$file")"
|
value="$(cat "$file")"
|
||||||
fi
|
fi
|
||||||
print_in_columns "$name: $value"
|
print_in_columns "$name: $value"
|
||||||
}
|
}
|
||||||
|
|
||||||
# System
|
# System
|
||||||
|
|
@ -50,58 +50,58 @@ echo ""
|
||||||
# Processor
|
# Processor
|
||||||
echo -e "${BLUE}Processor${CLEAR}"
|
echo -e "${BLUE}Processor${CLEAR}"
|
||||||
lscpu | grep -E '^(Arch|CPU.s.|Core|Thread|Model name|Virt)' \
|
lscpu | grep -E '^(Arch|CPU.s.|Core|Thread|Model name|Virt)' \
|
||||||
| sed -r 's/\(s\)(.*:)/s\1 /' \
|
| sed -r 's/\(s\)(.*:)/s\1 /' \
|
||||||
| sed -r 's/CPUs: /Threads:/' \
|
| sed -r 's/CPUs: /Threads:/' \
|
||||||
| sed -r 's/^(.*:) / \1/'
|
| sed -r 's/^(.*:) / \1/'
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Memory
|
# Memory
|
||||||
echo -e "${BLUE}Memory${CLEAR}"
|
echo -e "${BLUE}Memory${CLEAR}"
|
||||||
first_device="True"
|
first_device="True"
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ "$line" == "Memory Device" ]]; then
|
if [[ "$line" == "Memory Device" ]]; then
|
||||||
if [[ "$first_device" == "True" ]]; then
|
if [[ "$first_device" == "True" ]]; then
|
||||||
first_device="False"
|
first_device="False"
|
||||||
else
|
|
||||||
# Add space between devices
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
print_in_columns "$line"
|
# Add space between devices
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
print_in_columns "$line"
|
||||||
|
fi
|
||||||
done <<< $(sudo dmidecode -t memory \
|
done <<< $(sudo dmidecode -t memory \
|
||||||
| grep -E '^(Memory Device|\s+(Type|Size|Speed|Manuf.*|Locator|Part Number):)')
|
| grep -E '^(Memory Device|\s+(Type|Size|Speed|Manuf.*|Locator|Part Number):)')
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Graphics
|
# Graphics
|
||||||
echo -e "${BLUE}Graphics${CLEAR}"
|
echo -e "${BLUE}Graphics${CLEAR}"
|
||||||
lspci | grep 'VGA' | sed -r 's/^.*:/ Device: /' \
|
lspci | grep 'VGA' | sed -r 's/^.*:/ Device: /' \
|
||||||
| sed 's/Intel Corporation/Intel/' \
|
| sed 's/Intel Corporation/Intel/' \
|
||||||
| sed 's/Generation Core Processor Family/Gen/' \
|
| sed 's/Generation Core Processor Family/Gen/' \
|
||||||
| sed 's/Integrated Graphics Controller.*/iGPU/'
|
| sed 's/Integrated Graphics Controller.*/iGPU/'
|
||||||
glxinfo 2>/dev/null | grep 'OpenGL renderer' | sed -r 's/^.*:/ OpenGL Renderer: /' \
|
glxinfo 2>/dev/null | grep 'OpenGL renderer' | sed -r 's/^.*:/ OpenGL Renderer: /' \
|
||||||
| sed 's/Mesa DRI //'
|
| sed 's/Mesa DRI //'
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
echo -e "${BLUE}Audio${CLEAR}"
|
echo -e "${BLUE}Audio${CLEAR}"
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ "$line" =~ .*no.soundcards.found.* ]]; then
|
if [[ "$line" = .*no.soundcards.found.* ]]; then
|
||||||
echo " No soundcards found"
|
echo " No soundcards found"
|
||||||
else
|
else
|
||||||
print_in_columns "$line"
|
print_in_columns "$line"
|
||||||
fi
|
fi
|
||||||
done <<< $(aplay -l 2>&1 | grep -Ei '(^card|no soundcards found)' | sed -r 's/.*\[(.*)\].*\[(.*)\].*/\1: \2/')
|
done <<< $(aplay -l 2>&1 | grep -Ei '(^card|no soundcards found)' | sed -r 's/.*\[(.*)\].*\[(.*)\].*/\1: \2/')
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Network
|
# Network
|
||||||
echo -e "${BLUE}Network${CLEAR}"
|
echo -e "${BLUE}Network${CLEAR}"
|
||||||
lspci | grep -Ei '(ethernet|network|wireless|wifi)' \
|
lspci | grep -Ei '(ethernet|network|wireless|wifi)' \
|
||||||
| sed -r 's/.*: (.*)$/ \1/'
|
| sed -r 's/.*: (.*)$/ \1/'
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Drives
|
# Drives
|
||||||
echo -e "${BLUE}Drives${CLEAR}"
|
echo -e "${BLUE}Drives${CLEAR}"
|
||||||
hw-drive-info | sed 's/^/ /'
|
hw-drive-info | sed 's/^/ /'
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
## Wizard Kit: HW Diagnostics - Benchmarks
|
|
||||||
|
|
||||||
function usage {
|
|
||||||
echo "Usage: ${0} device log-file"
|
|
||||||
echo " e.g. ${0} /dev/sda /tmp/tmp.XXXXXXX/benchmarks.log"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Bail early
|
|
||||||
if [ ! -b "${1}" ]; then
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run Benchmarks
|
|
||||||
echo 3 | sudo tee -a /proc/sys/vm/drop_caches >/dev/null 2>&1
|
|
||||||
sudo dd bs=4M if="${1}" of=/dev/null status=progress 2>&1 | tee -a "${2}"
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
#!/bin/python3
|
|
||||||
#
|
|
||||||
## Wizard Kit: HW Diagnostics - Menu
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Init
|
|
||||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
||||||
from functions.hw_diags import *
|
|
||||||
from functions.tmux import *
|
|
||||||
init_global_vars()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
# Show menu
|
|
||||||
try:
|
|
||||||
state = State()
|
|
||||||
menu_diags(state, sys.argv)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print_standard(' ')
|
|
||||||
print_warning('Aborted')
|
|
||||||
print_standard(' ')
|
|
||||||
sleep(1)
|
|
||||||
pause('Press Enter to exit...')
|
|
||||||
except SystemExit as sys_exit:
|
|
||||||
tmux_switch_client()
|
|
||||||
exit_script(sys_exit.code)
|
|
||||||
except:
|
|
||||||
# Cleanup
|
|
||||||
tmux_kill_all_panes()
|
|
||||||
|
|
||||||
if DEBUG_MODE:
|
|
||||||
# Custom major exception
|
|
||||||
print_standard(' ')
|
|
||||||
print_error('Major exception')
|
|
||||||
print_warning(SUPPORT_MESSAGE)
|
|
||||||
print(traceback.format_exc())
|
|
||||||
print_log(traceback.format_exc())
|
|
||||||
|
|
||||||
# Save debug reports and upload data
|
|
||||||
try_and_print(
|
|
||||||
message='Saving debug reports...',
|
|
||||||
function=save_debug_reports,
|
|
||||||
state=state, global_vars=global_vars)
|
|
||||||
question = 'Upload crash details to {}?'.format(CRASH_SERVER['Name'])
|
|
||||||
if ENABLED_UPLOAD_DATA and ask(question):
|
|
||||||
try_and_print(
|
|
||||||
message='Uploading Data...',
|
|
||||||
function=upload_logdir,
|
|
||||||
global_vars=global_vars)
|
|
||||||
|
|
||||||
# Done
|
|
||||||
sleep(1)
|
|
||||||
pause('Press Enter to exit...')
|
|
||||||
exit_script(1)
|
|
||||||
|
|
||||||
else:
|
|
||||||
# "Normal" major exception
|
|
||||||
major_exception()
|
|
||||||
|
|
||||||
# Done
|
|
||||||
tmux_kill_all_panes()
|
|
||||||
tmux_switch_client()
|
|
||||||
exit_script()
|
|
||||||
|
|
||||||
# vim: sts=2 sw=2 ts=2
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
#!/bin/python3
|
|
||||||
#
|
|
||||||
## Wizard Kit: HW Diagnostics - Network
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Init
|
|
||||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
||||||
from functions.network import *
|
|
||||||
|
|
||||||
|
|
||||||
def check_connection():
|
|
||||||
if not is_connected():
|
|
||||||
# Raise to cause NS in try_and_print()
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
try:
|
|
||||||
# Prep
|
|
||||||
clear_screen()
|
|
||||||
print_standard('Hardware Diagnostics: Network\n')
|
|
||||||
|
|
||||||
# Connect
|
|
||||||
print_standard('Initializing...')
|
|
||||||
connect_to_network()
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
try_and_print(
|
|
||||||
message='Network connection:', function=check_connection, cs='OK')
|
|
||||||
show_valid_addresses()
|
|
||||||
try_and_print(message='Internet connection:', function=ping,
|
|
||||||
addr='8.8.8.8', cs='OK')
|
|
||||||
try_and_print(message='DNS Resolution:', function=ping, cs='OK')
|
|
||||||
try_and_print(message='Speedtest:', function=speedtest,
|
|
||||||
print_return=True)
|
|
||||||
|
|
||||||
# Done
|
|
||||||
print_standard('\nDone.')
|
|
||||||
#pause("Press Enter to exit...")
|
|
||||||
exit_script()
|
|
||||||
except SystemExit as sys_exit:
|
|
||||||
exit_script(sys_exit.code)
|
|
||||||
except:
|
|
||||||
major_exception()
|
|
||||||
|
|
||||||
# vim: sts=2 sw=2 ts=2
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
## Wizard Kit: HW Diagnostics - Prime95
|
|
||||||
|
|
||||||
function usage {
|
|
||||||
echo "Usage: $0 log-dir"
|
|
||||||
echo " e.g. $0 /tmp/tmp.7Mh5f1RhSL9001"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Bail early
|
|
||||||
if [ ! -d "$1" ]; then
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run Prime95
|
|
||||||
cd "$1"
|
|
||||||
mprime -t | grep -iv --line-buffered 'stress.txt' | tee -a "prime.log"
|
|
||||||
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
|
|
||||||
BLUE='\033[34m'
|
|
||||||
CLEAR='\033[0m'
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
# List devices
|
|
||||||
for line in $(lsblk -do NAME,TRAN,SIZE,VENDOR,MODEL,SERIAL); do
|
|
||||||
if [[ "${line:0:4}" == "NAME" ]]; then
|
|
||||||
echo -e "${BLUE}${line}${CLEAR}"
|
|
||||||
else
|
|
||||||
echo "${line}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# List loopback devices
|
|
||||||
if [[ "$(losetup -l | wc -l)" > 0 ]]; then
|
|
||||||
for line in $(losetup -lO NAME,PARTSCAN,RO,BACK-FILE); do
|
|
||||||
if [[ "${line:0:4}" == "NAME" ]]; then
|
|
||||||
echo -e "${BLUE}${line}${CLEAR}"
|
|
||||||
else
|
|
||||||
echo "${line}" | sed -r 's#/dev/(loop[0-9]+)#\1 #'
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# List partitions
|
|
||||||
for line in $(lsblk -o NAME,SIZE,FSTYPE,LABEL,MOUNTPOINT); do
|
|
||||||
if [[ "${line:0:4}" == "NAME" ]]; then
|
|
||||||
echo -e "${BLUE}${line}${CLEAR}"
|
|
||||||
else
|
|
||||||
echo "${line}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
## Wizard Kit: Sensor monitoring tool
|
|
||||||
|
|
||||||
WINDOW_NAME="Hardware Sensors"
|
|
||||||
MONITOR="hw-sensors-monitor"
|
|
||||||
|
|
||||||
# Start session
|
|
||||||
tmux new-session -n "$WINDOW_NAME" "$MONITOR"
|
|
||||||
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
#!/bin/python3
|
|
||||||
#
|
|
||||||
## Wizard Kit: Sensor monitoring tool
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Init
|
|
||||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
||||||
from functions.sensors import *
|
|
||||||
from functions.tmux import *
|
|
||||||
init_global_vars(silent=True)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
background = False
|
|
||||||
try:
|
|
||||||
if len(sys.argv) > 1 and os.path.exists(sys.argv[1]):
|
|
||||||
background = True
|
|
||||||
monitor_file = sys.argv[1]
|
|
||||||
monitor_pane = None
|
|
||||||
else:
|
|
||||||
result = run_program(['mktemp'])
|
|
||||||
monitor_file = result.stdout.decode().strip()
|
|
||||||
if not background:
|
|
||||||
monitor_pane = tmux_split_window(
|
|
||||||
percent=1, vertical=True, watch=monitor_file)
|
|
||||||
cmd = ['tmux', 'resize-pane', '-Z', '-t', monitor_pane]
|
|
||||||
run_program(cmd, check=False)
|
|
||||||
monitor_sensors(monitor_pane, monitor_file)
|
|
||||||
exit_script()
|
|
||||||
except SystemExit as sys_exit:
|
|
||||||
exit_script(sys_exit.code)
|
|
||||||
except:
|
|
||||||
major_exception()
|
|
||||||
|
|
||||||
# vim: sts=2 sw=2 ts=2
|
|
||||||
Loading…
Reference in a new issue