From 6633a0a9a1adcf6c17e21aa1f172d1a8c9fcfb10 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 5 Feb 2026 10:46:59 -0500 Subject: [PATCH] Implement selective checks with --checks option Add the ability to run only specific diagnostic checks using --checks=cpu,ram,disk syntax. This allows users to perform targeted diagnostics without running the full suite. Supported checks: cpu, ram, memory, storage, disk, network, hardware, temps, services, ceph, vms, containers https://code.lotusguild.org/LotusGuild/proxDoc/issues/13 Co-Authored-By: Claude Opus 4.5 --- proxDoc.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/proxDoc.sh b/proxDoc.sh index b7771b1..e5aba17 100755 --- a/proxDoc.sh +++ b/proxDoc.sh @@ -475,13 +475,49 @@ get_hwmon_status() { fi } +# Valid check names for selective mode +readonly VALID_CHECKS="cpu ram memory storage disk network hardware temps services ceph vms containers" + run_selective_checks() { local checks="$1" if [[ -z "$checks" ]]; then log_message error "No checks specified. Use --checks=cpu,ram,disk" + echo "Valid checks: $VALID_CHECKS" exit 1 fi - log_message info "Selective checks not yet implemented" + + # Validate check names + IFS=',' read -ra check_array <<< "$checks" + for check in "${check_array[@]}"; do + if [[ ! " $VALID_CHECKS " =~ " $check " ]]; then + log_message error "Unknown check: $check" + echo "Valid checks: $VALID_CHECKS" + exit 1 + fi + done + + log_message info "Running selective checks: $checks" + echo "" + + for check in "${check_array[@]}"; do + case "$check" in + cpu) log_message info "Checking CPU..."; get_cpu_info ;; + ram) log_message info "Checking RAM..."; get_ram_info ;; + memory) log_message info "Checking memory details..."; get_memory_details ;; + storage) log_message info "Checking storage..."; get_storage_info ;; + disk) log_message info "Checking disk health..."; get_disk_health ;; + network) log_message info "Checking network..."; get_network_info; get_detailed_network; get_nic_details ;; + hardware) log_message info "Checking hardware..."; get_hardware_info; get_motherboard_info; get_hba_info ;; + temps) log_message info "Checking temperatures..."; get_temp_info ;; + services) log_message info "Checking services..."; check_services ;; + ceph) log_message info "Checking Ceph..."; get_ceph_health ;; + vms) log_message info "Checking VMs..."; list_vms ;; + containers) log_message info "Checking containers..."; list_containers ;; + esac + done + + echo "" + log_message info "Selective checks complete" } quick_health_check() { @@ -596,6 +632,10 @@ help() { echo " --backup Review backup health" echo " --checks=LIST Run only specific checks (comma-separated)" echo "" + echo "Valid checks for --checks option:" + echo " cpu, ram, memory, storage, disk, network, hardware, temps," + echo " services, ceph, vms, containers" + echo "" echo "Examples:" echo " Run full diagnostics:" echo " curl -sL \"http://10.10.10.63:3000/LotusGuild/proxDoc/raw/branch/main/proxDoc.sh\" | bash -s -- --diags" @@ -612,6 +652,9 @@ help() { echo "" echo " Check Ceph cluster health:" echo " curl -sL \"http://10.10.10.63:3000/LotusGuild/proxDoc/raw/branch/main/proxDoc.sh\" | bash -s -- --ceph" + echo "" + echo " Run only CPU and RAM checks:" + echo " curl -sL \"http://10.10.10.63:3000/LotusGuild/proxDoc/raw/branch/main/proxDoc.sh\" | bash -s -- --checks=cpu,ram" exit 0 }