I wrote a small plugin for nagios (http://www.nagios.org/) to monitor whether CruiseControl runs or hangs. It depends
on a installed lynx. Here it is:
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
# parse arguments
if [ $# -lt 3 ]; then
echo "usage: check_cruisecontrol -H host pause"
exit 1
fi
host=$2
pause=$3
# get current state and number of projects
noprojects=0
while true; do
url="http://${host}:8000/getattribute?objectname=CruiseControl%20Manager:id=unique&attribute=Projects&format=collection&template=viewcollection"
if [ $noprojects -gt 0 ]; then
url="${url}&start=${noprojects}"
fi
lynx -source ${url} > /tmp/check_cruisecontrol-$$-$noprojects
if [ $? -ne 0 ]; then
echo "CruiseControl CRITICAL: Unknown host!"
exit 2
fi
grep net\.sourceforge\.cruisecontrol\.Project /tmp/check_cruisecontrol-$$-$noprojects > /dev/null
if [ $? -ne 0 ]; then
break
fi
noprojects=`expr $noprojects + 30`
done
# get current state
sleep $pause
project=0
while [ $project -lt $noprojects ]; do
url="http://${host}:8000/getattribute?objectname=CruiseControl%20Manager:id=unique&attribute=Projects&format=collection&template=viewcollection"
if [ $project -gt 0 ]; then
url="${url}&start=${project}"
fi
lynx -source ${url} > /tmp/check_cruisecontrol-$$-${project}-d
diff /tmp/check_cruisecontrol-$$-$project /tmp/check_cruisecontrol-$$-${project}-d > /dev/null
if [ $? -gt 0 ]; then
rm /tmp/check_cruisecontrol-$$-*
echo "CruiseControl OK: -"
exit 0
fi
project=`expr $project + 30`
done
rm /tmp/check_cruisecontrol-$$-*
echo "CruiseControl CRITICAL: It hangs!"
exit 2
Powered by a free Atlassian Confluence Open Source Project / Non-profit License granted to ThoughtWorks, Inc.. Evaluate Confluence today.