Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Nagios check #3568

Merged
merged 1 commit into from Feb 8, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1,39 +1,46 @@
#!/bin/sh

if [ -z "$3" ]; then
echo "usage: check_galaxy <server> <username> <password>"
echo "usage: check_galaxy <server> <username> <password> <handler>"
exit 3
fi

# not sure why this is necessary, but nagios' $HOME is /root, despite not running as root.
HOME=/var/lib/nagios
export HOME

here=`dirname $0`
var="$HOME/.check_galaxy/$1"
host=`basename $1`
handler="$4"
var="$HOME/.check_galaxy/$host/$handler"

mkdir -p $var
touch $var/iterations
iterations=`cat $var/iterations`
if [ -z "$iterations" ]; then
iterations=0
fi

new_history=''
if [ $iterations -gt 96 ]; then
if [ $iterations -gt 64 ]; then
new_history='-n'
echo 0 > $var/iterations
else
echo `expr $iterations + 1` > $var/iterations
fi

date >> $var/log
status=`python $here/check_galaxy.py $new_history $1 $2 $3 2>&1 | tee -a $var/log | tail -n 1`
status=`python $here/check_galaxy.py $new_history $1 $2 $3 $4 2>&1 | tee -a $var/log | tail -n 1`

echo "$status"

case "$status" in
"Exception: Tool never finished")
exit 1
;;
"OK")
"OK: "*)
exit 0
;;
"AssertionError: "*)
exit 1
;;
*)
exit 2
;;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.