Last active
October 6, 2016 16:43
-
-
Save dotmaik1/4961ad902d0c2c5c50cce1c90d38bd55 to your computer and use it in GitHub Desktop.
Automated script that checks if the threshold has been exceded
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
| # set -x | |
| # Shell script to monitor or watch the disk space | |
| # name: fs_check.sh | |
| # umbrales: 85-89% WARNING; 90-99% SERIOUS; 100% CRITICAL | |
| # ===================================================================================================# | |
| # Set admin email so that you can get email. | |
| email="[email protected]" | |
| # Include list of FS to monitoring, if several partions then use "|" to separate the partitions. | |
| INCLUDE_LIST="/u01|/u04|/u05|/oradata" | |
| # | |
| #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
| fecha=$(date) | |
| for i in $(df -Pk | grep -E "${INCLUDE_LIST}" | awk '{print $1}') | |
| do | |
| usep=$(df -Pk | grep "$i" | awk '{ print $5}' | cut -d'%' -f1) | |
| mp=$(df -Pk | grep "$i" | awk '{ print $6}') | |
| if [[ $usep -ge 85 && $usep -le 89 ]] | |
| then | |
| asunto="WARNING: Database or OracleHome File System $mp esta al $usep % en $(hostname) - $fecha" | |
| df -Pk | mailx -s "${asunto}" $email | |
| elif [[ $usep -ge 90 && $usep -le 99 ]] | |
| then | |
| asunto="SERIOUS: Database or OracleHome File System $mp esta al $usep % en $(hostname) - $fecha" | |
| df -Pk | mailx -s "${asunto}" $email | |
| elif [[ $usep -eq 100 ]] | |
| then | |
| asunto="CRITICAL: Database or OracleHome File System $mp esta al $usep % en $(hostname) - $fecha" | |
| df -Pk | mailx -s "${asunto}" $email | |
| fi | |
| done | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment