Giter VIP home page Giter VIP logo

check_sftp's Introduction

This NCPA plugin is made to monitor SFTP server health.

Functionalities :

  • Disk usage or dedicated partition disk usage for sftp service ;
  • SFTP access availability (supports also SFTP service on non-default port) ;
  • SFTP active connections ;
  • Connected users using SFTP.

Setup

To install this script, just put it in the plugins folder of the NCPA agent of target server and enable bash support in the NCPA config file. For this, you have to add the .bash extension management (Yes, it's needed, despite #!/bin/bash at the beginning of the script, NCPA will by default use sh :)). To add this, just go to the "Extensions for plugins" section under "Linux / Mac OS X" and write this line for example after .sh:

.bash = /bin/bash $plugin_name $plugin_args

Save the file and restart NCPA agent:

sudo service ncpa restart
# Or... If you prefer...
sudo systemctl restart ncpa

You're done.

Please keep in mind the NCPA agent is needed of course (see here for installation: https://www.nagios.org/ncpa/#downloads).

If you want to adapt the script to your own monitoring solution or to a cron job (very easy), I will not explain it but it's totally possible. This plugin is published with a public license (as all other plugins and scripts here), so feel free to fork or use it in your own scripts or programs!

Usage

To test, use it like this:

./check_sftp -P <partition> -d <disk_usage_threshold> -i <check_interval> -p <sftp_port>

Full usage, options and explanations are accessible with the -h argument.

./check_sftp -h

To use it as NCPA plugin, create a command and an associated service in Nagios like this example:

# Command
define command {
    command_name check_sftp
    command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ -t 'your_token' -M 'plugins/check_sftp.bash' -q 'args=-P /dev/sdb1,args=-d 85,args=-i 5,args=-n internal-sftp,args=-p 22'
}
# Service
define service {
    use                     generic-service
    hostname                your-server ;(or hostgroup_name          servers-group for a group of servers !)
    service_description     SFTP health
    check_command           check_sftp
    contacts                mailadmin
    max_check_attempts      3
    check_interval          5
    retry_interval          1
    notification_interval   0
}

As always, check your nagios configuration:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Then restart Nagios service and that's all!

Samples

Examples of status: alt text alt text

check_sftp's People

Contributors

spadeeagle44 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.