469,288 Members | 2,357 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,288 developers. It's quick & easy.

use Filesys::Diskspace

Hi

I want to monitor disk space and send a email if it exceeds the limit.
I m using "use Filesys:: Diskspace" but there is an error in compling.
Expand|Select|Wrap|Line Numbers
  1.  
  2. "Can't locate Filesys/Diskspace.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at disk.pl line 4.
  3. BEGIN failed--compilation aborted at disk.pl line 4."
Thanks
Vasu
Mar 13 '07 #1
8 6457
KevinADC
4,059 Expert 2GB
You need to install the module.
Mar 13 '07 #2
miller
1,089 Expert 1GB
That is not part of the core modules of perl:
http://perldoc.perl.org/index-modules-F.html

So as Kevin states, you'll have to install it:
http://cpan.perl.org/misc/cpan-faq.h...l_Perl_modules

I'm not certain this'll be a module you want to use though. By browing the cpan description, you'll notice that the module has not been updated since 1999. This might be a problem, but I would consider looking through the other Filesys modules to determine if there is one that might be better, as in maintained more frequently and therefore supports more file systems.
http://search.cpan.org/search?query=Filesys

- Miller
Mar 13 '07 #3
KevinADC
4,059 Expert 2GB
Use perl to send the email but personally, I would think the operating system would be better equiped to handle the disk monitoring.
Mar 13 '07 #4
miller
1,089 Expert 1GB
Use perl to send the email but personally, I would think the operating system would be better equiped to handle the disk monitoring.
Hrm.... you're probably right Kev. I think I fell into an X-Y trap as I tend to shy away from platform specific solutions if they can be avoided.

Nevertheless, since this is meant for a specific machine, a simple parsing of `df` might be acceptable:

Expand|Select|Wrap|Line Numbers
  1. my @filesystems = `df`;
  2. shift @filesystems; # Remove header row
  3. foreach (@filesystems) {
  4.     my ($fs, undef, undef, $avail) = split /\s+/;
  5.     print "$fs = $avail\n";
  6. }
  7.  
- Miller
Mar 13 '07 #5
KevinADC
4,059 Expert 2GB
I love perl but somethings are just so much easier using the OS. If this had to be cross platform then sticking with perl would most likely be the way to go, but since it's not and this doesn't sound like anything too mission critical, I'd go with the OS if it were me.

Maybe the OP will even reply to this thread... ;)
Mar 14 '07 #6
Thank you Miller


Hrm.... you're probably right Kev. I think I fell into an X-Y trap as I tend to shy away from platform specific solutions if they can be avoided.

Nevertheless, since this is meant for a specific machine, a simple parsing of `df` might be acceptable:

Expand|Select|Wrap|Line Numbers
  1. my @filesystems = `df`;
  2. shift @filesystems; # Remove header row
  3. foreach (@filesystems) {
  4.     my ($fs, undef, undef, $avail) = split /\s+/;
  5.     print "$fs = $avail\n";
  6. }
  7.  
- Miller
Mar 14 '07 #7
Thank you Kevin

Vasu

You need to install the module.
Mar 14 '07 #8
miller
1,089 Expert 1GB
Thank you Kevin

Vasu
Your welcome Vasu

Happy to help.

- Miller
Mar 14 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.