An Error Occurred . Statfs Failed. Did You Run H2ph
to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter. Re: [EP-tech] An error occured. statfs failedFrom: ePrints Support
for next month's dinner Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] In case anyone is interested: Filesys::Df Works, but seems to only be happy with the mount name, and not an arbitrary directory under the mount. Meaning, if you had a http://www.eprints.org/tech.php/90.html mount (say, '/shared'), and a directory under the mount (say, '/shared/ofer/project47'), then df( '/shared' ) works, but df( '/shared/ofer/project47' ) doesn't. Filesys::DiskSpace Got the following error message: "An error occured. statfs failed. Did you run h2ph? Cannot use df on this machine (untested or unsupported). at http://mail.pm.org/pipermail/losangeles-pm/2005-February/000973.html ./foo.pl line 30" Filesys::DiskFree Flexible enough to take any directory, no errors... we have a winner! -ofer On Fri, 11 Feb 2005, Ofer Nave wrote: > > Found three so far: > > Filesys::Df > Filesys::DiskFree > Filesys::DiskSpace > > Anyone know anything about these and can recommend one over the others? > > Man, I'm tellin ya, a wiki would be killer for this stuff. :) > > -ofer > > _______________________________________________ > Losangeles-pm mailing list > Losangeles-pm at pm.org > http://mail.pm.org/mailman/listinfo/losangeles-pm > Previous message: [LA.pm] modules for testing free disk space Next message: Report on : [LA.pm] Dinner - 2/15, 7pm -- AND call for suggestions for next month's dinner Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the Losangeles-pm mailing list
5, 2008 in Debian Linux, File system, FreeBSD, Gentoo Linux, Howto, Linux, Monitoring, OpenBSD, OS X, Perl, RedHat/Fedora Linux, Sys admin, Tips, Ubuntu Linux, UNIXHere is a quick question by one of our regular reader :
How to write a http://www.cyberciti.biz/tips/howto-write-perl-script-to-monitor-disk-space.html perl script that can monitor my disk space under UNIX or Linux and send https://sources.debian.net/patches/libfilesys-diskspace-perl/0.05-16/000-changes-extracted-from-sources.diff/ 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::DiskSpaceFirst you need to install this perl module using apt-get or from cpan an error (Comprehensive Perl Archive Network). $ sudo apt-get install libfilesys-diskspace-perl Perl script code to monitor disk spaceNow write a perl script called df.pl: $ vi df.pl Append following code:#!/usr/bin/perl use strict; use warnings; use Filesys::DiskSpace; # file system /home or /dev/sda5 my $dir = "/home"; # get data for /home fs my ($fs_type, $fs_desc, $used, $avail, $fused, $favail) = df $dir; # calculate free space in % my $df_free = (($avail) an error occurred / ($avail+$used)) * 100.0; # display message my $out = sprintf("Disk space on $dir == %0.2f\n",$df_free); print $out;Save and close the file. Run this script as follows: $ chmod +x df.pl$ ./df.pl Output: Disk space on /home == 75.35 So /home has 75.35% free disk space. Next logical step is to compare this number to limit so that you can send an email if only 10% free disk space is left on /home file system. Here is the code with#!/usr/bin/perl use strict; use warnings; use Filesys::DiskSpace; my $dir = "/home"; # warning level 10% my $warning_level=10; my ($fs_type, $fs_desc, $used, $avail, $fused, $favail) = df $dir; my $df_free = (($avail) / ($avail+$used)) * 100.0; # compare free disk space with warning level if ($df_free < $warning_level) { my $out = sprintf("Send an Email - Disk space on $dir => %0.2f%% (WARNING Low Disk Space)\n",$df_free); print $out; } else { my $out = sprintf("Disk space on $dir => %0.2f%% (OK)\n",$df_free); print $out; }Run script as follows: $ ./df.pl Output:Send an Email - Disk space on /home => 3.99% (WARNING Low Disk Space)Here is final code that send an email alert ( download):#!/usr/bin/perl # Available under BSD License. See url for more info: # http://www.cyberciti.biz/tips/howto-write-perl-script-to-monitor-disk-space.html use strict; use warnings; use Fi
id="line1" class="codeline ">Description: Patch created from changes on upstream sources. Author: Dario Minnucci