HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/thread-self/root/usr/lib64/nagios/plugins/vz7_check_a2_zombie-procs.sh
#!/bin/bash

# Get the number of zombie processes
zombie_procs=$(ps -eo stat |grep -c '^Z')

# Check if the number of zombie processes exceeds the threshold if so run script and crit
if [[ "${zombie_procs}" -gt 250 ]]; then
  if [ ! -f "/etc/cron.d/zombie_check" ]; then
    /opt/bin/zombie_procs.sh
    echo "Zombie_Processes - ${zombie_procs} zombie processes detected - CRIT"
    exit 2
  else
    echo "Zombie_Processes - ${zombie_procs} zombie processes detected - CRIT"
    exit 2
  fi
else
  if [ -f "/etc/cron.d/zombie_check" ]; then
    rm -f /etc/cron.d/zombie_check
    echo "Zombie_Processes - ${zombie_procs} zombie processes detected - OK"
    exit 0
  else
    echo "Zombie_Processes - ${zombie_procs} zombie processes detected - OK"
    exit 0
  fi
fi