summaryrefslogtreecommitdiffstats
path: root/contrib/check_ftpget.pl
diff options
context:
space:
mode:
authorM. Sean Finney <seanius@users.sourceforge.net>2005-06-26 16:27:05 +0000
committerM. Sean Finney <seanius@users.sourceforge.net>2005-06-26 16:27:05 +0000
commit69e1b0fe391b611fed0dd57422dbff76d5ea9546 (patch)
tree59b0ef368deb4e4574a869f1c75df8a9cefa0c5e /contrib/check_ftpget.pl
parent9bab24cf9573700751ba5f43fe7966f5ca338e47 (diff)
downloadmonitoring-plugins-69e1b0fe391b611fed0dd57422dbff76d5ea9546.tar.gz
spring cleaning of contrib directory from andreas
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1192 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib/check_ftpget.pl')
-rwxr-xr-xcontrib/check_ftpget.pl48
1 files changed, 0 insertions, 48 deletions
diff --git a/contrib/check_ftpget.pl b/contrib/check_ftpget.pl
deleted file mode 100755
index de7e8242..00000000
--- a/contrib/check_ftpget.pl
+++ /dev/null
@@ -1,48 +0,0 @@
1#!/usr/bin/perl -w
2## Written 12/5/00 Jeremy Hanmer
3# $Id$
4
5use strict;
6use Net::FTP;
7use Getopt::Std;
8
9use vars qw($opt_H $opt_u $opt_p $opt_f);
10getopts("H:u:p:f:");
11
12my $host = $opt_H ||
13 die "usage: check_ftp.pl -h host [<-u user> <-p pass> <-f file>]\n";
14
15my $username = $opt_u || 'anonymous';
16my $pass = $opt_p || "$ENV{'LOGNAME'}\@$ENV{'HOSTNAME'}" ;
17
18my $file = $opt_f;
19
20my $status = 0;
21my $problem;
22my $output = "ftp ok";
23
24my $ftp = Net::FTP->new("$host") ||
25 &crit("connect");
26
27$ftp->login("$username", "$pass") ||
28 &crit("login");
29
30$ftp->get($file) ||
31 &crit("get") if $file;
32
33sub crit()
34{
35 $problem = $_[0];
36 $status = 2;
37 if ( $problem eq 'connect' ) {
38 $output = "can't connect";
39 } elsif ( $problem eq 'login' ) {
40 $output = "can't log in";
41 } elsif ( $problem eq 'get' ) {
42 $output = "cant get $file";
43 }
44}
45
46print "$output\n";
47exit $status;
48