Ad Widget

Collapse

Hung ssh processes with external checks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grommir
    Senior Member
    • Mar 2013
    • 134

    #1

    Hung ssh processes with external checks

    The task was to monitor the availability of the SFTP server. Since it's just not available for ssh, we decided to use lftp and made the following script:

    Code:
    if result=$(lftp -u "$3,$2" sftp://$1 -e 'ls;quit' 2>&1); then
        rc=$?
        stderr="none"
    else
        rc=$?
        stderr=$result
    fi
    
    echo "{\"error\": \"$stderr\", \"exit_code\": \"$rc\"}"
    Created item with external check "test-sftp.sh[{HOST.CONN},{$SFTP_PASSWORD},{$SFTP_USER}]" and two dependent.

    Checks themselves work, but zombie began to spawn. Like that:

    Code:
     
     zabbix   32680  0.0  0.0      0     0 ?        Zs   06:42   0:00 [ssh] <defunct>
    Processes are spawned to thousands, until the zabbix server stops working. At this point, as a workaround, I created a cron job that kills zombie processes, but I want to know how to fix this in the usual way?
Working...