Monitoring plugin to check free space on SFTP share


This is a monitoring plugin for icinga to check the free space on a sftp share.

It was initially developed by intranda GmbH.


This script requires a working key authentication without password to the sftp host. You can set it up like this:

ssh-keygen -t rsa
ssh-keygen -e -f ~/.ssh/ | grep -v "Comment:" > ~/.ssh/
cat ~/.ssh/ >> backup_authorized_keys
echo mkdir .ssh | sftp USER@HOST
scp backup_authorized_keys USER@HOST:.ssh/authorized_keys

See also:


Try the plugin at the command line like this:

./ -h [host] -u [user] [ -o sftpOpt ] -w [warn] -c [crit]

Replace the variables:

  • host: sftp host to connect to
  • user: username at the sftp server
  • sftpOpt: extra sftp option, e.g. port=23
  • warn: percentage of needed minimum free space before warning
  • crit: percentage of needed minimum free space before critical

You can define the icinga2 check command as follows:

/* Define check command for check_sftpspace */
object CheckCommand "sftpspace" {
  import "plugin-check-command"
  command = [ PluginDir + "/" ]

  arguments = {
    "-h" = {
      "required" = true
      "value" = "$ss_host$"
    "-u" = {
      "required" = true
      "value" = "$ss_user$"
    "-o" = {
      "required" = false
      "value" = "$ss_sftpOpt$"
    "-w" = {
      "required" = true
      "value" = "$ss_warn$"
    "-c" = {
      "required" = true
      "value" = "$ss_crit$"

  vars.ss_warn = 30
  vars.ss_crit = 10



This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see