Monitoring Diskspace Usage on Linux
While I would always advocate to monitor OS metrics like disk space usage with an agent (i.e. Enterprise Manager/Zabbix/Prometheus) sometimes, that's not always an option. For a recent edge case I needed to drop in a crontab script and wanted something dynamic (no hard coding) and informative. Here's what I came up with that may be useful for others.
The output will look something like this:
Running low on space "/dev/sda1 (85%)" on server.domain.com as on Tue Jul 3 12:54:39 EDT 2018. It is mounted at /u01.
**This email was
generated from a script run on server.domain.com**
The output will look something like this:
Running low on space "/dev/sda1 (85%)" on server.domain.com as on Tue Jul 3 12:54:39 EDT 2018. It is mounted at /u01.
To find large
directories in the mount use the disk usage command, i.e. - du -ax /u01 | sort -n -r | head -n 10
This comment has been removed by a blog administrator.
ReplyDelete