����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 18.191.125.73 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /lib64/nagios/plugins/extra/ |
Upload File : |
#!/bin/bash while [ -n "$1" ] do case "$1" in --cpu) LCPU="$2";; --mem) LMEM="$2";; --disk) LDISK="$2";; esac shift done if [ -z "$LCPU" ] && [ -z "$LMEM" ] && [ -z "$LDISK" ]; then echo no arguments passed exit 2 fi VMS=$(virsh list --name | egrep -v '^$') exit=0 declare -a LVS if [ -n "$LDISK" ]; then while read -r device size; do id=$(echo $device | tr -dc '0-9') size=$(echo $size | sed -e 's/g$//' | cut -d, -f1) size=$( printf "%.0f" $size ) LVS[$id]=$size done < <(lvs vg2 --units g --noheadings -o lv_name,lv_size) fi for vm in $VMS; do echo $vm | /bin/egrep -q "^guest" && continue id=$(echo $vm | tr -dc '0-9') ip=$(jq -r ".${vm}.mainipaddress" /var/tmp/.solusvm.vms.cache) if [ -n "$LMEM" ]; then mem=$(virsh dommemstat $vm | grep actual |awk '{print $2/1024}') if [ "$mem" -gt "$LMEM" ]; then echo "$vm/$ip has more memory (${mem}MB) than limit ($LMEM)" exit=1 fi fi if [ -n "$LCPU" ]; then vcpu=$(virsh vcpuinfo $vm | grep -c ^VCPU) if [ "$vcpu" -gt "$LCPU" ]; then echo "$vm/$ip has more vCPU cores ($vcpu) than limit ($LCPU)" exit=1 fi fi if [ -n "$LDISK" ]; then disk=${LVS[$id]} if [ "$disk" -gt "$LDISK" ]; then echo "$vm/$ip has biggest disk device (${disk}GB) than limit ($LDISK)" exit=1 fi fi done if [ $exit -eq 0 ]; then echo OK fi exit $exit