Created
November 7, 2016 07:22
-
-
Save dijeesh/cd5de2d846d3c0eaec2388abe2a11e4b to your computer and use it in GitHub Desktop.
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/bash | |
| # XenServer Disk Monitoring and post message to XenCenter | |
| # Get this host's UUID | |
| thisUUID=`xe host-list name-label=$HOSTNAME params=uuid --minimal` | |
| # Threshold of disk usage to report on | |
| threshold=75 # an example of how much disk can be used before alerting | |
| # Get disk usage | |
| diskUsage=`df -h | grep "/$" | head -n 1 | awk {' print $5 '} | sed -n -e "s/%//p"` | |
| # Check | |
| if [ $diskUsage -gt $threshold ]; then | |
| xe message-create host-uuid=$thisUUID name="ROOT DISK USAGE" body="Disk space use has exceeded $diskUsage on `echo $HOSTNAME`!" priority="1" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment