Skip to content

Instantly share code, notes, and snippets.

@hcoyote
Created February 22, 2012 17:28
Show Gist options
  • Save hcoyote/1886191 to your computer and use it in GitHub Desktop.
Save hcoyote/1886191 to your computer and use it in GitHub Desktop.
Run hadoop fsck and determine if our HDFS is corrupt in some way. This is very basic and could be extended further to tell you what the corruption really is.
#!/bin/sh
if [ -x /usr/bin/hadoop ] ; then
chk_hdfs=`/usr/bin/hadoop fsck / | grep 'filesystem under path'`
case $chk_hdfs in
*HEALTHY*)
echo "OK - HDFS is healthy"
exit 0
;;
*)
echo "CRITICAL - HDFS is corrupt!"
exit 2
;;
esac
else
echo "UNKNOWN - can't execute /usr/bin/hadoop"
exit 3
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment