Forum Discussion

jpeterson6's avatar
jpeterson6
Icon for Nimbostratus rankNimbostratus
Aug 15, 2017

SFTP External Monitor fails but manual script execution succeeds

Hi,

I've been working on setting up an SFTP monitor for some time now. I'm getting really close but there's one thing left that I'm having a hard time understanding and is just not working as expected.

Here is the base script:

 !/bin/bash

IP=`echo ${1} | sed 's/::ffff://'`
PORT=${2}

sftp -o Port=${PORT} -b /home/ext_monitor/cyclone/sftpmonitor.input sftpMonitor@${IP} | grep 'IB' 2>$1 > /dev/null

 mark node UP if expected response was received
if [ $? -eq 0 ]
then
  echo "UP"
fi

When I upload this script to the F5 and execute it manually (using IP and Port arguments in-line) it works just fine.

What I'm trying to do is attach this to the pool level; there are 4 pool members and my understanding is the first two variables ($1 (ipv6 address) and $2 (port)) are auto-populated by the F5 when it tries connecting in the external monitor, but the monitor was failing.

Next, I modified the script a bit so that instead of using IP and PORT variables, I just hard-coded one of the pool member information and attached the monitor at the pool member level, but that also failed.

Any assistance I could get would be very appreciated... I feel like I'm very close and just missing a couple key things here.

Here's the current monitor configuration:

ltm monitor external external-sftp-cyclone {
    defaults-from external
    destination *:*
    interval 5
    run /Common/external-cyclone-sftp-2022
    time-until-up 0
    timeout 16
}

Also, in case it is relevant: I do also have a tcp monitor attached alongside it as I cannot risk the pool member going down at this time while I test this.

3 Replies