Last active
December 15, 2015 17:48
-
-
Save tomasvitek/5298580 to your computer and use it in GitHub Desktop.
UNIX monitoring system `monit` (http://mmonit.com/monit/) can check space usage on regular filesystems, but can't on a RAID filesystem. This script is a workaround. Usage: Copy `monit_raid_size` script to `/usr/local/bin` and make it executable, set a cron entry for it to 10 minutes and check for timestamp in `monitrc` configuration file.
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 | |
# Copy this file to `/usr/local/bin` and make this file executable. | |
# Set a cron entry for this script for 10 minutes (see `crontab` file bellow). | |
# The space usage limit | |
readonly PERCENT=90 | |
if [ `df -h /dev/md0 | egrep -o '([[:digit:]]{1,3})%' | egrep -o '([[:digit:]]{1,3})' ` -lt PERCENT ] then | |
touch /var/tmp/monit_flag_raid | |
fi |
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
*/10 * * * * monit_raid_size > /dev/null 2>&1 |
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
check file raid_hdd with path /var/tmp/monit_flag_raid | |
if timestamp > 25 minutes then alert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment