HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //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