aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authorswills <swills@FreeBSD.org>2011-08-14 01:29:20 +0800
committerswills <swills@FreeBSD.org>2011-08-14 01:29:20 +0800
commitf41507d5f7a7c9c4098b690e02577fefb02dde2e (patch)
treed83aa84bc857d7dd9cc9cad7dc28a07cb9352db8 /net-mgmt
parent007c6dd645ef8f46122bdba38b02bc9d31fc012d (diff)
downloadfreebsd-ports-gnome-f41507d5f7a7c9c4098b690e02577fefb02dde2e.tar.gz
freebsd-ports-gnome-f41507d5f7a7c9c4098b690e02577fefb02dde2e.tar.zst
freebsd-ports-gnome-f41507d5f7a7c9c4098b690e02577fefb02dde2e.zip
Nagios plugin for checking tftp servers. This plugin can retrieve a file and
compare the size with a given value. WWW: http://mathias-kettner.de/download/check_tftp PR: ports/159737 Submitted by: hr <holgerrepp at googlemail.com>
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/Makefile1
-rw-r--r--net-mgmt/nagios-check_tftp/Makefile37
-rw-r--r--net-mgmt/nagios-check_tftp/distinfo2
-rw-r--r--net-mgmt/nagios-check_tftp/files/patch-check_tftp54
-rw-r--r--net-mgmt/nagios-check_tftp/pkg-descr4
5 files changed, 98 insertions, 0 deletions
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 7d6162ad6b25..c97995a7a748 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -127,6 +127,7 @@
SUBDIR += nagios-check_ports
SUBDIR += nagios-check_puppet
SUBDIR += nagios-check_smartmon
+ SUBDIR += nagios-check_tftp
SUBDIR += nagios-devel
SUBDIR += nagios-geom
SUBDIR += nagios-pf-plugin
diff --git a/net-mgmt/nagios-check_tftp/Makefile b/net-mgmt/nagios-check_tftp/Makefile
new file mode 100644
index 000000000000..ad732574cbde
--- /dev/null
+++ b/net-mgmt/nagios-check_tftp/Makefile
@@ -0,0 +1,37 @@
+# New ports collection makefile for: check_tftp
+# Date created: 7 August 2011
+# Whom: hr <holgerrepp@googlemail.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= check_tftp
+PORTVERSION= 1.0.1
+CATEGORIES= net-mgmt
+MASTER_SITES= http://mathias-kettner.de/download/
+PKGNAMEPREFIX= nagios-
+DISTNAME= ${PORTNAME}
+EXTRACT_SUFX=
+
+MAINTAINER= holgerrepp@googlemail.com
+COMMENT= Nagios plugin to check tftp servers
+
+RUN_DEPENDS= bash:${PORTSDIR}/shells/bash \
+ ${LOCALBASE}/bin/tftp:${PORTSDIR}/ftp/tftp-hpa
+
+PLIST_DIRSTRY= libexec/nagios
+PLIST_FILES= libexec/nagios/check_tftp
+NO_BUILD= yes
+NO_WRKSUBDIR= yes
+
+post-patch:
+ ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/check_tftp
+
+do-extract:
+ @${MKDIR} ${WRKDIR}
+ @${CP} ${DISTDIR}/${PORTNAME} ${WRKDIR}/
+do-install:
+ @${MKDIR} ${PREFIX}/libexec/nagios
+ @${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${PREFIX}/libexec/nagios
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/nagios-check_tftp/distinfo b/net-mgmt/nagios-check_tftp/distinfo
new file mode 100644
index 000000000000..7d78a356e95b
--- /dev/null
+++ b/net-mgmt/nagios-check_tftp/distinfo
@@ -0,0 +1,2 @@
+SHA256 (check_tftp) = 48881276122cb774d4ad80cb5557fbae34d1c19bc2b41c712b39a8244111b97b
+SIZE (check_tftp) = 21243
diff --git a/net-mgmt/nagios-check_tftp/files/patch-check_tftp b/net-mgmt/nagios-check_tftp/files/patch-check_tftp
new file mode 100644
index 000000000000..7964e55574bf
--- /dev/null
+++ b/net-mgmt/nagios-check_tftp/files/patch-check_tftp
@@ -0,0 +1,54 @@
+--- ./check_tftp.orig 2011-08-13 12:15:04.000000000 +0200
++++ ./check_tftp 2011-08-13 12:22:28.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!%%LOCALBASE%%/bin/bash
+ #
+ # check_tftp
+ #
+@@ -317,6 +317,7 @@
+ STATE_UNKNOWN=3
+ STATE_DEPENDENT=4
+
++TFTP="%%LOCALBASE%%/bin/tftp -v"
+
+ function print_version () {
+ cat <<EOF
+@@ -412,7 +413,7 @@
+ echo "Cannot create temporary directory in /tmp"
+ exit $STATE_UNKNOWN
+ }
+- RESULT="$(echo get NaGiOs_ChEcK_FiLe | tftp $HOST 2>&1 | head -n 1)"
++ RESULT="$(echo get NaGiOs_ChEcK_FiLe | ${TFTP} $HOST 2>&1 | tail -n 2 | head -n 1)"
+ cd ..
+ rm -f "$TMPDIR/NaGiOs_ChEcK_FiLe"
+ rmdir "$TMPDIR"
+@@ -440,16 +441,15 @@
+ echo "Cannot create temporary directory in /tmp"
+ exit $STATE_UNKNOWN
+ }
+- RESULT="$(echo get $FILENAME | tftp $HOST 2>&1 | head -n 1)"
++ RESULT="$(echo get $FILENAME | ${TFTP} $HOST 2>&1 | tail -n 2 | head -n 1)"
+ if [ -f "$FILENAME" ] ; then
+- ACTSIZE="$(wc "$FILENAME" --bytes | awk '{print $1;}')"
++ ACTSIZE="$(wc -c "$FILENAME" | awk '{print $1;}')"
+ else
+ ACTSIZE=0
+ fi
+
+- rm -f "$FILENAME"
+ cd ..
+- rmdir "$TMPDIR"
++ rm -r "$TMPDIR"
+
+ check_principal_errors "$RESULT"
+ case "$RESULT" in
+@@ -457,7 +457,7 @@
+ echo "Server answered: file $FILE not found"
+ exit $STATE_CRITICAL
+ ;;
+- *"Received "*" bytes in "*" seconds")
++ *"Received "*" bytes in "*" seconds "*)
+ if [ "$SIZE" -ge "$ACTSIZE" -a "$SIZE" -le "$ACTSIZE" ] ; then
+ echo "OK - ${RESULT#*tftp> }"
+ exit $STATE_OK
diff --git a/net-mgmt/nagios-check_tftp/pkg-descr b/net-mgmt/nagios-check_tftp/pkg-descr
new file mode 100644
index 000000000000..9898a0ce681d
--- /dev/null
+++ b/net-mgmt/nagios-check_tftp/pkg-descr
@@ -0,0 +1,4 @@
+Nagios plugin for checking tftp servers. This plugin can retrieve a file and
+compare the size with a given value.
+
+WWW: http://mathias-kettner.de/download/check_tftp