Created
May 11, 2019 13:57
-
-
Save shyamjos/1c590deee629cf1be2ea467ba9697c0a to your computer and use it in GitHub Desktop.
Icinga2 plugin to check if server rebooted
This file contains 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/bash | |
# shyam jos | |
# Icinga plugin to check if server was rebooted less than 30 minutes ago | |
read -d. uptime < /proc/uptime | |
days=$(( uptime/60/60/24 )) | |
if (( uptime > 1800 )) | |
then | |
echo -n "OK! UP $days days | uptime_days=$days" | |
exit 0 | |
else | |
echo "Critical: Reboot Detected! - Server Rebooted Less than 30 minutes ago! | uptime_days=$days" | |
exit 2 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment