403Webshell
Server IP : 162.19.112.25  /  Your IP : 216.73.216.88
Web Server : LiteSpeed
System : Linux qamar.tasjeel.ae 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64
User : archiart ( 1428)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/check_mk_agent/local/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/check_mk_agent/local/Status_Httpd
#!/bin/bash
# CheckMK Local Check - Status_Httpd (Unified Apache / LiteSpeed)

SERVICE_NAME=""
if systemctl is-active --quiet httpd; then
    SERVICE_NAME="httpd"
elif systemctl is-active --quiet lshttpd; then
    SERVICE_NAME="lshttpd"
else
    echo "3 Status_Httpd - UNKNOWN - No Apache or LiteSpeed service found"
    exit 0
fi

# Check service status
if systemctl is-active --quiet "$SERVICE_NAME"; then
    STATE_TEXT="RUNNING"
else
    echo "2 Status_Httpd status=0;;;; - $SERVICE_NAME is DOWN"
    exit 0
fi

# Count active connections on port 80 or 443
CONN_COUNT=$(ss -tan '( sport = :80 or sport = :443 )' | grep ESTAB | wc -l)

# Count worker processes
WORKER_COUNT=$(pgrep -c "$SERVICE_NAME")

# Set thresholds
CONN_WARN=750
CONN_CRIT=1000
WORKER_WARN=150
WORKER_CRIT=250

# Determine status
FINAL_STATE=0
STATUS_MSG="- OK"
if (( CONN_COUNT > CONN_CRIT || WORKER_COUNT > WORKER_CRIT )); then
    FINAL_STATE=2
    STATUS_MSG="- CRITICAL Load"
elif (( CONN_COUNT > CONN_WARN || WORKER_COUNT > WORKER_WARN )); then
    FINAL_STATE=1
    STATUS_MSG="- HIGH Load"
fi

# ✅ Output with corrected service name
echo "$FINAL_STATE Status_Httpd connections=${CONN_COUNT};${CONN_WARN};${CONN_CRIT};; workers=${WORKER_COUNT};${WORKER_WARN};${WORKER_CRIT};; - $SERVICE_NAME $STATE_TEXT $STATUS_MSG | CONN=$CONN_COUNT WORKERS=$WORKER_COUNT"


Youez - 2016 - github.com/yon3zu
LinuXploit