Created
February 27, 2025 20:36
-
-
Save piercefreeman/05a253e1c617c363c729e5985c5ecc6c to your computer and use it in GitHub Desktop.
Echo host configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "============== RUNNING SYSTEM DIAGNOSTICS ==============" | |
| # Create output file | |
| OUTPUT_FILE="system_diagnostics_$(hostname)_$(date +%Y%m%d).txt" | |
| exec > >(tee -a "$OUTPUT_FILE") 2>&1 | |
| echo "=================== HOST INFORMATION ===================" | |
| echo "Hostname: $(hostname)" | |
| echo "Date: $(date)" | |
| echo "=================== CPU ARCHITECTURE ===================" | |
| # CPU model and features | |
| echo "CPU Information:" | |
| lscpu | |
| echo "---" | |
| echo "CPU Features:" | |
| cat /proc/cpuinfo | grep flags | head -1 | |
| echo "---" | |
| echo "CPU Microcode Version:" | |
| cat /proc/cpuinfo | grep microcode | head -1 | |
| echo "---" | |
| echo "CPU Vulnerabilities:" | |
| ls -1 /sys/devices/system/cpu/vulnerabilities/ 2>/dev/null | while read vuln; do | |
| echo "$vuln: $(cat /sys/devices/system/cpu/vulnerabilities/$vuln 2>/dev/null)" | |
| done | |
| echo "================ KERNEL & OS INFORMATION ===============" | |
| echo "Kernel version: $(uname -a)" | |
| echo "---" | |
| echo "OS release information:" | |
| cat /etc/os-release | |
| echo "---" | |
| echo "Kernel parameters:" | |
| sysctl -a | grep -E 'vm.swappiness|kernel.panic|kernel.randomize|kernel.sched_migration_cost' | |
| echo "---" | |
| echo "Memory configuration:" | |
| free -h | |
| echo "---" | |
| echo "Transparent Hugepages:" | |
| cat /sys/kernel/mm/transparent_hugepage/enabled | |
| echo "================== DOCKER INFORMATION ==================" | |
| echo "Docker version:" | |
| docker version | |
| echo "---" | |
| echo "Docker info:" | |
| docker info | |
| echo "---" | |
| echo "Docker storage driver:" | |
| docker info | grep "Storage Driver" | |
| echo "---" | |
| echo "Container runtime:" | |
| docker info | grep "Runtime" | |
| echo "================ HARDWARE CAPABILITIES =================" | |
| echo "NUMA configuration:" | |
| numactl --hardware 2>/dev/null || echo "numactl not available" | |
| echo "---" | |
| echo "Memory stats:" | |
| cat /proc/meminfo | grep -E 'HugePages_|Hugepagesize|DirectMap' | |
| echo "---" | |
| echo "Hardware RNG:" | |
| ls -la /dev/random /dev/urandom | |
| cat /proc/sys/kernel/random/entropy_avail | |
| echo "================ CONTAINER SPECIFIC INFO ===============" | |
| echo "Checking container configuration:" | |
| docker inspect 2549f85638f4 | grep -E 'CpuShares|Memory|CpusetCpus|NanoCpus|OomScoreAdj|PidsLimit' | |
| echo "================ CPU INSTRUCTION SUPPORT ================" | |
| # Check for AVX/AVX2/AVX512 support - often causes subtle issues with compiled code | |
| echo "AVX Support:" | |
| cat /proc/cpuinfo | grep -E 'avx' | head -1 | |
| echo "---" | |
| echo "Available CPU Instructions:" | |
| cat /proc/cpuinfo | grep flags | head -1 | tr ' ' '\n' | grep -E 'sse|avx|fma|bmi|adx|sha|aes' | |
| echo "================== SYSTEM LOAD/HEALTH ===================" | |
| echo "Current Load:" | |
| uptime | |
| echo "---" | |
| echo "Memory Pressure:" | |
| vmstat 1 3 | |
| echo "---" | |
| echo "IO Pressure:" | |
| iostat 1 3 2>/dev/null || echo "iostat not available" | |
| echo "=================== DIAGNOSTIC COMPLETE ==================" | |
| echo "Results saved to $OUTPUT_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment