Skip to content

Instantly share code, notes, and snippets.

@fredsmith
Created May 11, 2011 21:02
Show Gist options
  • Save fredsmith/967348 to your computer and use it in GitHub Desktop.
Save fredsmith/967348 to your computer and use it in GitHub Desktop.
Hadoop Nagios check under-replicated blocks
#! /bin/bash
function http { (exec 3<>/dev/tcp/$1/$2; echo -e "$3 $4 HTTP/1.0\r\n\r\n" >&3; cat <&3); }
URB=$(http localhost 50070 GET /dfshealth.jsp | grep Under-Replicated | sed -e 's/.*Under-Replicated//' -e 's/.*col3\"> //' -e 's/<.*//')
if [ $URB -gt 0 ]; then
echo "WARNING - Under-Replicated Blocks is $URB"
exit 1
fi
echo "OK - Under-Replicated Blocks is $URB"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment