Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
added bash generic nagios check
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ Asghar committed Oct 2, 2013
1 parent 1155bba commit 0ffe4db
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions nagios_check_generic_template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

CHECK_FILE=somefile
ERRORRANGE=20
HIGHRANGE=20
LOWRANGE=0
somecommand=`echo blah`
stateid=
WWW_DIR=/var/www
OFF=/var/www/off

if [ -f "${OFF}" ]
then
echo OFF
stateid=1
exit $stateid
else


if [ "${somecomand}" -eq 0 ];
then
if [ ! \( -e "${WWW_DIR}/${CHECK_FILE}" \) ];
then
cd /var/www/
sudo ln -s ${CHECK_FILE_TMP} ${CHECK_FILE}
fi
echo The Global somecommand is OK
stateid=0
elif [ "${somecommand}" -ge "${LOWRANGE}" ] && [ "${somecommand}" -lt "${HIGHRANGE}" ];
then
echo The Global somecommand is in a Warning state at "${somecommand}"
stateid=1
elif [ "${somecommand}" -ge ${ERRORRANGE} ];
then
if [ \( -h "${WWW_DIR}/${CHECK_FILE}" \) ];
then
cd /var/www/
sudo rm ${CHECK_FILE}
fi
echo The Global somecommand is in a Critical state at "${somecommand}"
stateid=2
fi
exit $stateid
fi

0 comments on commit 0ffe4db

Please sign in to comment.