403Webshell
Server IP : 192.250.235.158  /  Your IP : 216.73.216.143
Web Server : LiteSpeed
System : Linux s4099.sgp1.stableserver.net 5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jan 12 09:45:05 EST 2025 x86_64
User : vmxfzbqj ( 1905)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib64/nagios/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib64/nagios/plugins/a2_yum_processes.shared
#!/bin/bash
#
# SysEng Project: https://jira.a2hosting.com/browse/SYSENG-1853
# Refactored - https://a2hosting.atlassian.net/browse/SYSENG-27232
#
yum_procs=( $(ps aux | grep /usr/bin/yum | grep -v grep | awk '{print $2}') )
yum_proc_count=( $(ps aux | grep /usr/bin/yum | grep -vc grep) )
yum_max_age=21600 # 6 hours
threshold=1


if [[ ! "$(hostname -f)" =~ (a2hosting.com|supercp.com)$ ]]; then
  # random sleep to prevent running on all VMs on the same node at the same time
  sleep $(( ( RANDOM % 120 )  + 1 ))
fi

if [[ "${yum_proc_count}" -gt "${threshold}" ]]; then
  for proc in ${yum_procs[@]}; do
    yum_proc_age=$(ps -p ${proc} -o etimes=)
    if [[ "${yum_proc_age}" -gt "${yum_max_age}" ]]; then
      echo "${count} processes running"
      exit 2
      break
    fi
  done
else
  echo "YUM processes - OK"
  exit 0
fi

Youez - 2016 - github.com/yon3zu
LinuXploit