Disk space alerts [Linux]
11-05-2015, 02:13 AM
(This post was last modified: 11-05-2015, 02:16 AM by fairbanksk.)
For another project I recently had to implement a warning system to alert when a server was close to reaching a defined threshold of disk space. The script I wrote is for Linux servers and can be found at https://github.com/KevinFairbanks/diskMonkey
To implement on your server upload diskMonkey to a spot on your server, for me I have a directory in my root user home directory called scripts.
Add execute permissions to the file:
Add the script to your crontab:
I set mine to run every 5 minutes
Options:
At the top of the diskMonkey file you will find 3 options to control the script
ADMIN - where the notifications go can be local user ie root or remote email address ie you@yourdomain.tld
ALERT - the level at which you want alerts to appear, anything over this level will be notified
EXCLUDE_LIST - any partitions you wish to ignore
To implement on your server upload diskMonkey to a spot on your server, for me I have a directory in my root user home directory called scripts.
Add execute permissions to the file:
Code:
chmod +x diskMonkey
Add the script to your crontab:
Code:
crontab -e
Code:
*/5 * * * * /root/scripts/diskMonkey
Options:
At the top of the diskMonkey file you will find 3 options to control the script
ADMIN - where the notifications go can be local user ie root or remote email address ie you@yourdomain.tld
ALERT - the level at which you want alerts to appear, anything over this level will be notified
EXCLUDE_LIST - any partitions you wish to ignore