| 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 : /proc/thread-self/root/proc/thread-self/root/lib/check_mk_agent/local/ |
Upload File : |
#!/bin/bash
# CheckMK Local Check - Status_PureFTPd
SERVICE_NAME="pure-ftpd"
CONN_WARN=50 # FTP abuse warning threshold
CONN_CRIT=80 # Critical threshold
# Check if service exists
if ! systemctl list-units --type=service | grep -q "$SERVICE_NAME"; then
echo "3 Status_PureFTPd - UNKNOWN - Service not found"
exit 0
fi
# Check if service is running
if systemctl is-active --quiet "$SERVICE_NAME"; then
STATE=0
STATE_TEXT="RUNNING"
else
echo "2 Status_PureFTPd - CRITICAL - $SERVICE_NAME is DOWN"
exit 0
fi
# Count active FTP connections (only ESTABLISHED to port 21)
CONN_COUNT=$(ss -tan '( dport = :21 )' | grep ESTAB | wc -l)
# Apply thresholds
if (( CONN_COUNT > CONN_CRIT )); then
STATE=2
STATE_TEXT="CRITICAL FTP Load"
elif (( CONN_COUNT > CONN_WARN )); then
STATE=1
STATE_TEXT="HIGH FTP Load"
fi
# Output to CheckMK format
echo "$STATE Status_PureFTPd connections=${CONN_COUNT};${CONN_WARN};${CONN_CRIT};; - PureFTPD $STATE_TEXT | CONN=$CONN_COUNT"