Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_tftp.sh

Rating
5 votes
Favoured:
1
Hits
97179
Files:
FileDescription
check_tftp.shcheck tftp
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
The plugin check_tftp monitors availability of a TFTP Server, which is normaly used for booting clients over the network.
It downloads a test file from the TFTP server and checks its size against a given value.
Reviews (4)
Good but in newer versions you have to change following lines:

ORIG:
RESULT="$(echo get NaGiOs_ChEcK_FiLe | tftp $HOST 2>&1 | head -n 1)"
TO
RESULT="$(echo get NaGiOs_ChEcK_FiLe | tftp -v $HOST 2>&1 | grep Received)"

ORIG:
RESULT="$(echo get $FILENAME | tftp $HOST 2>&1 | head -n 1)"
TO:
RESULT="$(echo get $FILENAME | tftp $HOST 2>&1 | grep Received)"

ORIG:
*"Received "*" bytes in "*" seconds")
TO:
*"Received "*" bytes in "*" seconds"*)

Than it will work fine again!

Klaus Tachtler.
bylgroschen, February 18, 2015
Works well.

I found a version 1.0.2 and there was a small bug on line 422:

RESULT=$(echo "$RESULT" | head -1 )

which grabbed the wrong string to fine the "file not found" message. Every time you ran the --connect it would return CRITICAL

RESULT=$(echo "$RESULT" | head -2 | tail -1 )

-will work there and return OK

(I will look into getting v1.0.2 on the exchange with the above patch if it is updated)
byhk@, May 9, 2013
besides the typo in line 411.

we had to copy the "create tempdir" part to the "connect only check" as otherwise tftp always fails for "permission denied" - resulting in this update:

function check_connect () {
HOST="$1"
# tmp-dir creation is necessary also for connect-only-check
# as the tftp get fails otherwise with "permission denied"
# 20130509 hk@kapper.net
TMPDIR=/tmp/check_tftp
mkdir -p "$TMPDIR"
cd "$TMPDIR" || {
echo "Cannot create temporary directory in /tmp"
exit $STATE_UNKNOWN
}
RESULT="$(echo get NaGiOs_ChEcK_FiLe | tftp $HOST 2>&1 | head -n 1)"
rm -f NaGiOs_ChEcK_FiLe
# call fixed - was: check_prinzipal_errors "$RESULT"
check_principal_errors "$RESULT"
case "$RESULT" in
*"Error code 1: File not found")
echo "TFTP OK - answer from server"
exit $STATE_OK
;;
*)
echo "$RESULT"
exit $STATE_CRITICAL
;;
esac
}
One minor typo I found was on line 411. check_prinzipal_errors should be check_principal_errors. Otherwise, works very well.