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

#13

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 10:46:59 -05:00
parent eff8eb3a3c
commit 6633a0a9a1

View File

@@ -475,13 +475,49 @@ get_hwmon_status() {
fi 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() { run_selective_checks() {
local checks="$1" local checks="$1"
if [[ -z "$checks" ]]; then if [[ -z "$checks" ]]; then
log_message error "No checks specified. Use --checks=cpu,ram,disk" log_message error "No checks specified. Use --checks=cpu,ram,disk"
echo "Valid checks: $VALID_CHECKS"
exit 1 exit 1
fi 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() { quick_health_check() {
@@ -596,6 +632,10 @@ help() {
echo " --backup Review backup health" echo " --backup Review backup health"
echo " --checks=LIST Run only specific checks (comma-separated)" echo " --checks=LIST Run only specific checks (comma-separated)"
echo "" 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 "Examples:"
echo " Run full diagnostics:" echo " Run full diagnostics:"
echo " curl -sL \"http://10.10.10.63:3000/LotusGuild/proxDoc/raw/branch/main/proxDoc.sh\" | bash -s -- --diags" 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 ""
echo " Check Ceph cluster health:" 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 " 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 exit 0
} }