ROOTPLOIT
Server: Apache
System: Linux node6122.myfcloud.com 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64
User: bashacomputer (1004)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/nagios/plugins/check_proxmox.sh
#!/bin/bash
# check_proxmox - check proxmox core services and statuses
# Requirements:
# Author: Tsvetan Gerov <tsvetan@worldhost.group>
# Version 0.1

# Initialize flags and error message
CRTIICAL=false
WARNING=false
ERROR_MESSAGE=""


check_pveproxy(){
    if ! systemctl is-active pveproxy >/dev/null 2>&1; then
        CRTIICAL=true
        ERROR_MESSAGE+="PVE Proxy is down, "
    fi
}

check_cluster(){
    CSTATUS=$(pvesh get /cluster/status  --output-format=yaml | grep quorate | awk '{print$2}')
    if [ "$CSTATUS" != "1" ]; then
        CRTIICAL=true
        ERROR_MESSAGE+="Check Cluster Quorum, "
    fi
}

# Perform checks
check_pveproxy
check_cluster

# Return final state
if [ "$CRTIICAL" = true ]; then
    echo "[CRTIICAL] ${ERROR_MESSAGE%, }"
    exit 2
elif [ "$WARNING" = true ]; then
    echo "[WARNING] ${ERROR_MESSAGE%, }"
    exit 1
else
    echo "[OK] All services are running correctly."
    exit 0
fi