HEX
Server: LiteSpeed
System: Linux s12787.usc1.stableserver.net 5.14.0-570.32.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 6 11:30:41 EDT 2025 x86_64
User: househiv (1652)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //usr/lib64/nagios/plugins/check_a2_whmcs_nginx_connections.sh
#!/bin/bash 
# Ref - SYSENG-27485 - send nginx connection status to mother!
# by - sbhat
#

n_data=$(curl -s --connect-timeout 5 https://my.a2hosting.com/nginx_status)
active_conn=$(echo -e ${n_data} | grep "Active connections:" | awk '{print $3}')
reading_conn=$(echo -e ${n_data} | grep "Reading:" | awk '{print $12}')
writing_conn=$(echo -e ${n_data} | grep "Writing:" | awk '{print $14}')
waiting_conn=$(echo -e ${n_data} | grep "Waiting:" | awk '{print $NF}')

# Determine status for active connections
if [ "$active_conn" -gt 200 ]; then
  echo "check_a2_whmcs_nginx_connections - nginx has more than 200 active connections"
  exit 2
else
  echo "check_a2_whmcs_nginx_connections - nginx has less than 200 active connections"
  exit 0
fi