Skip to content

Instantly share code, notes, and snippets.

@alchemyx
Created January 7, 2021 21:08
Show Gist options
  • Select an option

  • Save alchemyx/2315333244e33c0f691f2422b0ca0482 to your computer and use it in GitHub Desktop.

Select an option

Save alchemyx/2315333244e33c0f691f2422b0ca0482 to your computer and use it in GitHub Desktop.
Simple Nagios check for tftp
#!/bin/sh
# https://github.com/alchemyx
host=127.0.0.1
# Try to upload myself
cd $(dirname $0)
filename=$(basename $0)
output=$(/usr/bin/tftp $host -c put $filename)
retcode=$?
if [ $retcode -eq 0 ]; then
echo "OK - Uploaded to $host"
exit 0
else
echo "CRITICAL - Can't upload to $host - $output"
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment