use Filesys::Diskspace

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vasu1308
    New Member
    • Feb 2007
    • 31

    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.
    Code:
     
    "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.
    BEGIN failed--compilation aborted at disk.pl line 4."
    Thanks
    Vasu
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    You need to install the module.

    Comment

    • miller
      Recognized Expert Top Contributor
      • Oct 2006
      • 1086

      #3
      That is not part of the core modules of perl:


      So as Kevin states, you'll have to install it:


      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.


      - Miller

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Use perl to send the email but personally, I would think the operating system would be better equiped to handle the disk monitoring.

        Comment

        • miller
          Recognized Expert Top Contributor
          • Oct 2006
          • 1086

          #5
          Originally posted by KevinADC
          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:

          Code:
          my @filesystems = `df`;
          shift @filesystems; # Remove header row
          foreach (@filesystems) {
          	my ($fs, undef, undef, $avail) = split /\s+/;
          	print "$fs = $avail\n";
          }
          - Miller

          Comment

          • KevinADC
            Recognized Expert Specialist
            • Jan 2007
            • 4092

            #6
            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... ;)

            Comment

            • vasu1308
              New Member
              • Feb 2007
              • 31

              #7
              Thank you Miller


              Originally posted by 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:

              Code:
              my @filesystems = `df`;
              shift @filesystems; # Remove header row
              foreach (@filesystems) {
              	my ($fs, undef, undef, $avail) = split /\s+/;
              	print "$fs = $avail\n";
              }
              - Miller

              Comment

              • vasu1308
                New Member
                • Feb 2007
                • 31

                #8
                Thank you Kevin

                Vasu

                Originally posted by KevinADC
                You need to install the module.

                Comment

                • miller
                  Recognized Expert Top Contributor
                  • Oct 2006
                  • 1086

                  #9
                  Originally posted by vasu1308
                  Thank you Kevin

                  Vasu
                  Your welcome Vasu

                  Happy to help.

                  - Miller

                  Comment

                  Working...