# Monitor for SFTP

**URL:** <https://community.f5.com/t/monitor-for-sftp/53598>\
**Category:** Technical Forums\
**Tags:** management, monitoring\
**Created:** [July 21, 2008, 9:31pm UTC](https://community.f5.com/t/monitor-for-sftp/53598 "2008-07-21T21:31:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Hildebran1](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@Josh\_Hildebran1](https://community.f5.com/u/Josh_Hildebran1)\
**Post date:** [July 21, 2008, 9:31pm UTC](https://community.f5.com/t/monitor-for-sftp/53598/1 "2008-07-21T21:31:55Z")

</div>

Does anyone have a sample external monitor for monitoring nodes that are running an SFTP (via ssh) server?

A default “tcp” monitor on port 22 seems to kill the FTP server to the point where my FTP monitor on 21 stops functioning.. well, the monitor probably functions, but the server dies for a little while. I’m taking that up with the vendor (serv-u)..

But in the meantime, I’d like to have a real SFTP monitor that logs in and grabs a file. Preferably one that uses password authentication, not private key.

Thanks in advance!

-Kyoo

---

<div class="post-metadata">

**Author:** ![Josh\_Hildebran1](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@Josh\_Hildebran1](https://community.f5.com/u/Josh_Hildebran1)\
**Post date:** [July 22, 2008, 4:40pm UTC](https://community.f5.com/t/monitor-for-sftp/53598/2 "2008-07-22T16:40:51Z")

</div>

Has anyone successfully installed “lftp” on an LTM BigIP box? passing passwords on the command line to lftp is simple, and it handles SFTP and FTPS.

---

<div class="post-metadata">

**Author:** ![FMA\_199355](https://avatars.discourse-cdn.com/v4/letter/f/c77e96/32.png) [@FMA\_199355](https://community.f5.com/u/FMA_199355)\
**Post date:** [February 15, 2017, 1:48pm UTC](https://community.f5.com/t/monitor-for-sftp/53598/3 "2017-02-15T13:48:07Z")

</div>

Hey guys,

I followed hoolio’s approach (thanks for you idea) to build a tiny monitor and this seems to be working fine for me.

Here is the string which is executed within external monitor:

```tcl
sftp -o PubkeyAuthentication=yes -o IdentityFile=/root/.ssh/${PKEY} -b /home/${BFILE} ${USER}@${HOST} | grep ${MATCH} 2>&1 > /dev/null

```

Arguments here:

```tcl
`PKEY` - private key file name for SFTP authentication
`BFILE` - batch file specifing which commands to execute after login
`HOST` - ip address of SFTP server
`DEBUG` - 0/1 = on/off
`MATCH` - a string we are looking for to check health
`USER` - account to access SFTP
`

```

In CLI it looks like:

```tcl
sftp -o PubkeyAuthentication=yes -o IdentityFile=/root/.ssh/sftpmonitor_rsa -b /home/sftpmonitor.input f5_monitor@10.128.192.192

```

Batch file

```tcl
sftpmonitor.input

```

is nothing more than:

```tcl
dir
bye

```

SFTP administrator created a file named

```tcl
f5_health

```

which monitor is looking for. If it gets this string with grep, then we are marking pool member up. Otherwise it is red.

---

<div class="post-metadata">

**Author:** ![b\_kodan\_313047](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@b\_kodan\_313047](https://community.f5.com/u/b_kodan_313047)\
**Post date:** [September 12, 2017, 3:59pm UTC](https://community.f5.com/t/monitor-for-sftp/53598/4 "2017-09-12T15:59:10Z")

</div>

Hi FMA,

How do you manage the public key authenticatiion?

“PubkeyAuthentication=yes -o IdentityFile=/root/.ssh/sftpmonitor\_rsa”. I assume sftpmonitor\_rsa is the private key and is stored in server(/root/.ssh/sftpmonitor\_rsa).
