Skip to content

Instantly share code, notes, and snippets.

@fredsmith
Created May 11, 2011 21:02
Show Gist options
  • Save fredsmith/967351 to your computer and use it in GitHub Desktop.
Save fredsmith/967351 to your computer and use it in GitHub Desktop.
Hadoop Nagios check namenode storage mounts
#! /bin/bash
function http { (exec 3<>/dev/tcp/$1/$2; echo -e "$3 $4 HTTP/1.0\r\n\r\n" >&3; cat <&3); }
ACTIVEMOUNTS=$(http localhost 50070 GET /dfshealth.jsp | grep "Storage Directory" | sed -e 's/<tr>/\n/g' | grep -c Active)
if [ $ACTIVEMOUNTS -lt 3 ]; then
echo "CRITICAL - $ACTIVEMOUNTS storage directories active"
exit 2
fi
echo "OK - $ACTIVEMOUNTS storage directories active"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment