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: //usr/lib64/nagios/plugins/check_a2_jbk_client_limits.sh
#!/bin/bash
_zfs_clients=$(df -hm | grep "backups/" | grep -E "az|mi|nl|sg" -c)
_zfs_clients_gt3t=$(df -hm | grep "backups/"| awk '$3 > 3000000' | wc -l)
_zfs_clients_lt3t=$(df -hm | grep "backups/"| awk '$3 < 3000000' | wc -l)

if [[ "${_zfs_clients}" -gt 35 ]]; then
  if [[ "${_zfs_clients_gt3t}" -gt 5 ]] && [[ "${_zfs_clients_gt3t}" -lt 10 ]]; then
    echo -e "This server has ${_zfs_clients} clients, out of that ${_zfs_clients_gt3t} are > 3TBs and ${_zfs_clients_lt3t} are < 3TBs. Please consider migrating a couple of clients."
    exit 1
  elif [[ "${_zfs_clients_gt3t}" -gt 10 ]]; then
    echo -e "This server already has ${_zfs_clients_gt3t} large clients. Out of total ${_zfs_clients}, ${_zfs_clients_gt3t} are > 3TBs and ${_zfs_clients_lt3t} are < 3TBs, please consider migrating a couple of large clients for better storage balance."
    exit 1
  elif [[ "${_zfs_clients}" -gt 32 ]]; then
    echo -e "This server has ${_zfs_clients} clients, out of that ${_zfs_clients_gt3t} are > 3TBs and ${_zfs_clients_lt3t} are < 3TBs. Please consider migrating a couple of clients."
    exit 1
  fi
else
  echo "client total is healthy"
  exit 0
fi