Feb
22
2007

Perl script to monitor disk space and send an email

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. This routine displays information on a file system such as its type, the amount of disk space occupied, the total disk space and the number of inodes etc.

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
[More in this Article...]

Perl script to monitor disk space and send an email

Originally from nixCraft by nixcraft

Leave a Comment

Name (required)

Email (required)

Website

Comments

2007 (c) Tech Tips, Using the ReviewSaurus Theme : Powered by WordPress