ports/159737: [NEW PORT] Nagios plugin for checking tftp servers
Holger L. A. Repp
holgerrepp at googlemail.com
Sat Aug 13 11:20:09 UTC 2011
>Number: 159737
>Category: ports
>Synopsis: [NEW PORT] Nagios plugin for checking tftp servers
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sat Aug 13 11:20:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Holger L. A. Repp
>Release: 8.2-RELEASE
>Organization:
>Environment:
>Description:
Plugin for Nagios and/or Incinga. This plugin can check the availability of a tftp service as well it can retrieve a file and compare the size with an expected value.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# nagios-check_tftp
# nagios-check_tftp/files
# nagios-check_tftp/files/patch-check_tftp
# nagios-check_tftp/pkg-descr
# nagios-check_tftp/Makefile
# nagios-check_tftp/distinfo
#
echo c - nagios-check_tftp
mkdir -p nagios-check_tftp > /dev/null 2>&1
echo c - nagios-check_tftp/files
mkdir -p nagios-check_tftp/files > /dev/null 2>&1
echo x - nagios-check_tftp/files/patch-check_tftp
sed 's/^X//' >nagios-check_tftp/files/patch-check_tftp << '268bfffbaabd755475afbc9e9fa77dc0'
X--- ./check_tftp.orig 2011-08-13 12:15:04.000000000 +0200
X+++ ./check_tftp 2011-08-13 12:22:28.000000000 +0200
X@@ -1,4 +1,4 @@
X-#!/bin/bash
X+#!/usr/local/bin/bash
X #
X # check_tftp
X #
X@@ -317,6 +317,7 @@
X STATE_UNKNOWN=3
X STATE_DEPENDENT=4
X
X+TFTP="/usr/local/bin/tftp -v"
X
X function print_version () {
X cat <<EOF
X@@ -412,7 +413,7 @@
X echo "Cannot create temporary directory in /tmp"
X exit $STATE_UNKNOWN
X }
X- RESULT="$(echo get NaGiOs_ChEcK_FiLe | tftp $HOST 2>&1 | head -n 1)"
X+ RESULT="$(echo get NaGiOs_ChEcK_FiLe | ${TFTP} $HOST 2>&1 | tail -n 2 | head -n 1)"
X cd ..
X rm -f "$TMPDIR/NaGiOs_ChEcK_FiLe"
X rmdir "$TMPDIR"
X@@ -440,16 +441,15 @@
X echo "Cannot create temporary directory in /tmp"
X exit $STATE_UNKNOWN
X }
X- RESULT="$(echo get $FILENAME | tftp $HOST 2>&1 | head -n 1)"
X+ RESULT="$(echo get $FILENAME | ${TFTP} $HOST 2>&1 | tail -n 2 | head -n 1)"
X if [ -f "$FILENAME" ] ; then
X- ACTSIZE="$(wc "$FILENAME" --bytes | awk '{print $1;}')"
X+ ACTSIZE="$(wc -c "$FILENAME" | awk '{print $1;}')"
X else
X ACTSIZE=0
X fi
X
X- rm -f "$FILENAME"
X cd ..
X- rmdir "$TMPDIR"
X+ rm -r "$TMPDIR"
X
X check_principal_errors "$RESULT"
X case "$RESULT" in
X@@ -457,7 +457,7 @@
X echo "Server answered: file $FILE not found"
X exit $STATE_CRITICAL
X ;;
X- *"Received "*" bytes in "*" seconds")
X+ *"Received "*" bytes in "*" seconds "*)
X if [ "$SIZE" -ge "$ACTSIZE" -a "$SIZE" -le "$ACTSIZE" ] ; then
X echo "OK - ${RESULT#*tftp> }"
X exit $STATE_OK
268bfffbaabd755475afbc9e9fa77dc0
echo x - nagios-check_tftp/pkg-descr
sed 's/^X//' >nagios-check_tftp/pkg-descr << 'cf0d2abe357fd6818a36353ced0bb465'
XNagios plugin for checking tftp servers. It is written as bash script and
Xrequires tftp-hpa client binary.
XThis plugin is even able to retrieve a file an compare the size with a given
Xvalue.
X
XPlugin by Matthias Kettner (WWW: http://mathias-kettner.de/download/check_tftp).
cf0d2abe357fd6818a36353ced0bb465
echo x - nagios-check_tftp/Makefile
sed 's/^X//' >nagios-check_tftp/Makefile << 'bbc6d828bf092cc12c35659eb43a0317'
X# New ports collection makefile for: icinga-web
X# Date created: 7 August 2011
X# Whom: hr
X#
X# $FreeBSD$
X#
X
XPORTNAME= ${PLUGINNAME}
XPORTVERSION= 1.0.1
XCATEGORIES= net-mgmt
XMASTER_SITES= http://mathias-kettner.de/download/
XPKGNAMEPREFIX= nagios-
XDISTNAME= ${PLUGINNAME}
XEXTRACT_SUFX=
X
XMAINTAINER= holgerrepp at googlemail.com
XCOMMENT= Nagios plugin to check tftp servers
X
XRUN_DEPENDS= bash:${PORTSDIR}/shells/bash \
X tftp-hpa:${PORTSDIR}/ftp/tftp-hpa
X
XPLUGINNAME= check_tftp
X
XPLIST_DIRSTRY= libexec/nagios
XPLIST_FILES= libexec/nagios/check_tftp
XNO_BUILD= yes
XNO_WRKSUBDIR= yes
X
Xdo-extract:
X @${MKDIR} ${WRKDIR}
X @${CP} ${DISTDIR}/${PLUGINNAME} ${WRKDIR}/
Xdo-install:
X @${MKDIR} ${PREFIX}/libexec/nagios
X @${INSTALL_SCRIPT} ${WRKDIR}/${PLUGINNAME} ${PREFIX}/libexec/nagios
X
X.include <bsd.port.mk>
bbc6d828bf092cc12c35659eb43a0317
echo x - nagios-check_tftp/distinfo
sed 's/^X//' >nagios-check_tftp/distinfo << 'efba502b4f5df9b5b49337df151a75e0'
XSHA256 (check_tftp) = 48881276122cb774d4ad80cb5557fbae34d1c19bc2b41c712b39a8244111b97b
XSIZE (check_tftp) = 21243
efba502b4f5df9b5b49337df151a75e0
exit
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list