mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-20 00:21:35 +00:00
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>
This commit is contained in:
parent
088efcd3a7
commit
2173405bb1
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=279615
@ -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
|
||||
|
37
net-mgmt/nagios-check_tftp/Makefile
Normal file
37
net-mgmt/nagios-check_tftp/Makefile
Normal file
@ -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>
|
2
net-mgmt/nagios-check_tftp/distinfo
Normal file
2
net-mgmt/nagios-check_tftp/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
SHA256 (check_tftp) = 48881276122cb774d4ad80cb5557fbae34d1c19bc2b41c712b39a8244111b97b
|
||||
SIZE (check_tftp) = 21243
|
54
net-mgmt/nagios-check_tftp/files/patch-check_tftp
Normal file
54
net-mgmt/nagios-check_tftp/files/patch-check_tftp
Normal file
@ -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
|
4
net-mgmt/nagios-check_tftp/pkg-descr
Normal file
4
net-mgmt/nagios-check_tftp/pkg-descr
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user