Perl script to monitor disk space and send an email

Filed under
HowTos

How to write a perl script that can monitor my disk space under UNIX or Linux and send me an email alert? There is a nice perl system routine called Perl df or Filesys::DiskSpace.

Task: Install Filesys::DiskSpace

First you need to install this perl module using apt-get or from cpan (Comprehensive Perl Archive Network).

$ sudo apt-get install libfilesys-diskspace-perl

Perl script code to monitor disk space

Now write a perl script called df.pl:

$ vi df.pl

Full Story.