How can I monitor my /backups partition on my Debian-Lenny box?

I have sendmail and I would like to receive an email when my partition gets over, for instance, 80% of its total size.

link|improve this question

76% accept rate
feedback

2 Answers

up vote 1 down vote accepted

Write simple script that sends e-mail if space usage gets over 80% and add it to crontab. On FreeBSD crond sends an e-mails with output of each called program, probably on Debian it does the same. If not - use any CLI e-mail client, mail(1) for example.

Example of script that checks space usage and prints warning if it is more that 80%:

df /backups | awk 'NR==2 {sub("%","",$5); if ($5 >= 80) {printf "Warning! Space usage is %d%%\n", $5}}' 
link|improve this answer
Ok, I get the idea. Thanks a lot ! – Jonathan Rioux Jan 25 '11 at 16:00
feedback

Have a look at check_disk, which one of the nagios plugins. It is very flexible and the return codes are consistent. It's a tried and true solution.

I'm a big fan of nagios, but you don't need to install nagios server to use the plugins.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.