This commit is contained in:
60
proxDoc.sh
60
proxDoc.sh
@@ -79,10 +79,7 @@ check_requirements() {
|
||||
|
||||
|
||||
checkIfOnHypervisor() {
|
||||
if ! command -v pveversion >/dev/null 2>&1; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
command -v pveversion >/dev/null 2>&1
|
||||
}
|
||||
|
||||
###################
|
||||
@@ -91,10 +88,21 @@ checkIfOnHypervisor() {
|
||||
get_system_info() {
|
||||
echo -e "\n${GREEN}=== System Information ===${NC}"
|
||||
echo -e "\n${GREEN}=== Diagnostic Run: $(date '+%Y-%m-%d %H:%M:%S') ===${NC}"
|
||||
echo -e "${GREEN}Hostname:$(uname -n)${NC}"
|
||||
echo -e "${GREEN}Kernel:$(uname -r)${NC}"
|
||||
echo -e "${GREEN}Hostname:${NC} $(uname -n)"
|
||||
echo -e "${GREEN}Kernel:${NC} $(uname -r)"
|
||||
|
||||
if checkIfOnHypervisor; then
|
||||
echo -e "\n${GREEN}=== Proxmox Version ===${NC}"
|
||||
pveversion || echo "Not available"
|
||||
pveversion
|
||||
else
|
||||
echo -e "\n${GREEN}=== OS Information ===${NC}"
|
||||
if [[ -f /etc/os-release ]]; then
|
||||
source /etc/os-release
|
||||
echo -e "${GREEN}Distribution:${NC} $PRETTY_NAME"
|
||||
else
|
||||
echo "OS information not available"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
get_temp_info() {
|
||||
@@ -445,10 +453,16 @@ quick_health_check() {
|
||||
# Proxmox Specific Functions
|
||||
###################
|
||||
check_services() {
|
||||
if ! checkIfOnHypervisor; then
|
||||
log_message warn "Not on Proxmox - skipping Proxmox service checks"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Checking critical services:${NC}"
|
||||
services=("pvedaemon" "pveproxy" "pvecluster" "pve-cluster" "corosync")
|
||||
local services=("pvedaemon" "pveproxy" "pvecluster" "pve-cluster" "corosync")
|
||||
for service in "${services[@]}"; do
|
||||
status=$(systemctl is-active "$service")
|
||||
local status
|
||||
status=$(systemctl is-active "$service" 2>/dev/null || echo "not-found")
|
||||
echo -e "${GREEN}$service:${NC} $status"
|
||||
done
|
||||
}
|
||||
@@ -462,15 +476,25 @@ check_pve_version() {
|
||||
}
|
||||
|
||||
list_vms() {
|
||||
if ! checkIfOnHypervisor; then
|
||||
log_message info "Not on Proxmox - skipping VM list"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if command -v qm >/dev/null 2>&1; then
|
||||
echo -e "${GREEN}Virtual Machine Status:${NC}"
|
||||
qm list
|
||||
else
|
||||
handle_error "qm command not found"
|
||||
log_message warn "qm command not found"
|
||||
fi
|
||||
}
|
||||
|
||||
list_containers() {
|
||||
if ! checkIfOnHypervisor; then
|
||||
log_message info "Not on Proxmox - skipping container list"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if command -v pct >/dev/null 2>&1; then
|
||||
echo -e "\n${GREEN}=== LXC Container Status ===${NC}"
|
||||
pct list
|
||||
@@ -512,6 +536,16 @@ help() {
|
||||
###################
|
||||
runDiags() {
|
||||
log_message info "Beginning system examination..."
|
||||
|
||||
# Check if running on Proxmox
|
||||
local is_proxmox=false
|
||||
if checkIfOnHypervisor; then
|
||||
is_proxmox=true
|
||||
log_message info "Detected Proxmox VE hypervisor"
|
||||
else
|
||||
log_message warn "Not running on Proxmox VE - some checks will be skipped"
|
||||
fi
|
||||
|
||||
(
|
||||
get_system_info
|
||||
get_cpu_info
|
||||
@@ -529,14 +563,18 @@ runDiags() {
|
||||
get_system_status
|
||||
get_node_exporter_status
|
||||
get_hwmon_status
|
||||
|
||||
# Only run Proxmox-specific checks if on Proxmox
|
||||
if [[ "$is_proxmox" == true ]]; then
|
||||
get_ceph_health
|
||||
list_vms
|
||||
list_containers
|
||||
fi
|
||||
) & show_progress $!
|
||||
|
||||
log_message info "Examination complete"
|
||||
}
|
||||
|
||||
|
||||
checkForInput() {
|
||||
case $1 in
|
||||
--help) help ;;
|
||||
|
||||
Reference in New Issue
Block a user