Ad Widget

Collapse

FTP server/service surveillance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HEMA1
    Member
    • Jun 2008
    • 33

    #1

    FTP server/service surveillance

    Does any one know how to setup a function FTP test
    Like: check that user A can do a login and logout on ftp server.



    TNX
    Hema1
  • Tenzer
    Senior Member
    • Nov 2007
    • 316

    #2
    Set up a shell script which does it for you. You can make it in whatever script language you feel comfortable in.

    Comment

    • HEMA1
      Member
      • Jun 2008
      • 33

      #3
      Any suggestion how to do this script?.

      Any suggestion how to do this script?. or how to get the data faield to zabbix?

      #!/bin/sh
      HOST='ftp.users.qwest.net'
      USER='yourid'
      PASSWD='yourpw'

      ftp -n $HOST <<END_SCRIPT
      quote USER $USER
      quote PASS $PASSWD
      quit
      END_SCRIPT
      exit 0

      Comment

      • Tenzer
        Senior Member
        • Nov 2007
        • 316

        #4
        I would probably go with a PHP script and use cURL for accessing the FTP server, but that's since I have most experience in coding PHP scripts, so it depends on what you prefer.

        Comment

        • NOB
          Senior Member
          Zabbix Certified Specialist
          • Mar 2007
          • 469

          #5
          Hi

          if you have curl installed on your ZABBIX-Server, and most of
          us have it, because of the Web Monitoring part, then use it
          in an external script.

          You can specify some or all parameters (hostname, username, password)
          either in the ZABBIX item of type External check or hardcode
          it in the script.
          Place the script in the directory where the configuration parameter
          ExternalScripts in your zabbix_server.conf points to, set the execute
          permissions correctly and start checking the FTP login.

          The script basically looks like
          Code:
          curl ftp://username:password@host >/dev/null 2>&1
          echo $?
          The first parameter of the script is set by ZABBIX to the item's
          hostname. If you want to check this host, just use this.

          To enhance this solution you could add a valuemap for the exit codes
          of curl and specify it in the configuration of the item.

          HTH,

          Norbert.

          Comment

          • HEMA1
            Member
            • Jun 2008
            • 33

            #6
            hema1

            Sounds great :-)
            When checking if curl i can se that
            [root@zabbixdb1 ~]# /usr/bin/curl -V
            curl 7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
            Protocols: tftp ftp telnet dict ldap http file https ftps
            Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

            And the script is added to:
            [root@zabbixdb1 tmp]# more /etc/zabbix/externalscripts/ftp_check
            curl ftp://test:´xxxxxx@xxxxxx >/dev/null 2>&1
            echo $?

            But how do i integrate this in zabbix?
            Last edited by HEMA1; 10-10-2008, 10:32.

            Comment

            • NOB
              Senior Member
              Zabbix Certified Specialist
              • Mar 2007
              • 469

              #7
              Originally posted by HEMA1
              Sounds great :-)
              When checking if curl i can se that
              [root@zabbixdb1 ~]# /usr/bin/curl -V
              curl 7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
              Protocols: tftp ftp telnet dict ldap http file https ftps
              Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

              And the script is added to:
              [root@zabbixdb1 tmp]# more /etc/zabbix/externalscripts/ftp_check
              curl ftp://test:´xxxxxx@xxxxxx >/dev/null 2>&1
              echo $?

              But how do i integrate this in zabbix?
              Add an item of type External check to the host,
              set whatever you like as the description and set ftp_check[] as the Key.
              Type of information: Numeric (integer 64-bit)
              If you want you can define a value map for the curl return values.
              Be sure to set the right permissions for the script !
              The settings depend on your setup. The easiest but not the safest (everybody can read
              the script and the password in it) way is to do a chmod 755 ftp_check.

              HTH,

              Norbert.

              Comment

              • HEMA1
                Member
                • Jun 2008
                • 33

                #8
                Hema1

                TNX A new world has just been opened

                Comment

                • NOB
                  Senior Member
                  Zabbix Certified Specialist
                  • Mar 2007
                  • 469

                  #9
                  Originally posted by HEMA1
                  TNX A new world has just been opened
                  In the same simple way any Nagios plugin can be used.
                  Just ignore the output (after testing that it works) and pass the exit
                  code to a ZABBIX external check.

                  We use this just for remote checks like LDAP, DNS, etc.

                  Be aware, that this needs resources so you should not use
                  it for all possible checks.
                  Although it would be possible to do some checks (like number of processes running) via Nagios' check_by_ssh plugin: don't use it.
                  That's why there is a ZABBIX agent doing active Checks.

                  Because most of the Nagios plugins return the response time, we
                  use zabbix_sender in the check script to store those values in ZABBIX, too.

                  Regards

                  Norbert.

                  Comment

                  Working...