Created
December 16, 2015 21:34
-
-
Save zakx/7fb065cbccc633262a28 to your computer and use it in GitHub Desktop.
Icinga/nagios check for FSFE meetups @ chaosdorf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
fsfe=0 | |
for j in {1..7}; do | |
month=$(date +"%m") | |
date=$(date -d "$month/1 + 1 month - $j day" +"%w %F") | |
if [ ${date:0:1} -eq 3 ]; then | |
fsfe=${date:2} | |
fi | |
done | |
today=$(date +%F) | |
if [ "$today" = "$fsfe" ]; then | |
hour=$(date +%H) | |
if [ "$hour" -ge "19" ]; then | |
if [ "$hour" -lt "22" ]; then | |
# FSFE! | |
echo "CRITICAL - FSFE meetup in place" | |
exit 2 # CRITICAL | |
else | |
echo "OK - FSFE meetup should be over" | |
exit 0 # OK | |
fi | |
else | |
echo "WARNING - FSFE meetup today" | |
exit 1 # WARNING | |
fi | |
else | |
echo "OK - no FSFE meetup today" | |
exit 0 # OK | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment