An Error Occured Statfs Failed Did You Run H2ph
Q&A Tutorials Poetry RecentThreads NewestNodes Donate What'sNew on May 18, 2009 at 12:34UTC ( #764645=note: print w/replies, xml ) Need Help?? in reply to File System Monitoring You can use Filesys::DiskSpace, the Perl df. See howto-write-perl-script-to-monitor-disk-space for ideas. Drumming up your own solution with the Unix df command is only 10 lines of code or so. You could use something like sendmail to notify you if the disk space reaches a certain threshold. No experience with 'munin', scanning through the documentation it seems like everything but the kitchen sink. But what can your ETL tooling do for you? The ETL tools I worked with also produced useful statistics. Things like throughput, disk space requirements etc. Maybe this is something to look into. HTH Harry Comment on Re: File System MonitoringSelect or Download Code Replies are listed 'Best First'. Re^2: File System Monitoring by NateTut (Deacon) on May 18, 2009 at 21:40UTC Thanks I have whiped up a `df -k` solution, but Filesys::DiskSpace looks to be more robust. Other folks are watching the ETL jobs, I'm just trying to fill in the gaps. BTW does anyone know how to configure Linux sendmail to use a Yahoo POP3 account? [reply][d/l] Re^2: File System Monitoring by NateTut (Deacon) on May 19, 2009 at 15:59UTC Filesys::DiskSpace gave me the following error: An error occured. statvfs failed. Did you run h2ph? So I am trying Filesys::DfPortable... [reply][d/l][select] Re^3: File System Monitoring by dHarry (Abbot) on May 20, 2009 at 06:38UTC Did you run h2ph? no So I am trying Filesys::DfPortable... Not sure if that will bring relief, from the documentation: The module should work with all versions of Windows (95 and up), and with all flavors of Unix that implement the statvfs or the statfs calls... Did you install the module properly? What Unix do you use? I'm on Linux Redhat. [reply][d/l] Re^4: File System Monitoring by NateTut (Deacon) on May 20, 2009 at 17:52UTC The OS is Solaris 10. Filesys::DfPortable worked fine once I got a c compiler installed. I didn't investigate the reason for the h2ph message, I just read about a similar problem where the recommendation was to use a more up to date module. [reply][d/l] Re^3: File System Monitoring by jvector (Friar) on May 20, 2009 at 12:08UTC ... or you could try running h2ph as it asks. This signature will be ready by Christmas [reply]
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.perlmonks.org/?node_id=764645 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 http://www.cyberciti.biz/tips/howto-write-perl-script-to-monitor-disk-space.html 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 http://marc.info/?l=mon&m=98520822926787&w=2 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 an error or from cpan (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 % an error occured my $df_free = (($avail) / ($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
> On Tue, 20 Mar 2001, Derek Callaway wrote: > > > [root@pager mon.d]# perl freespace.monitor /mnt/network/dpec:1000 > > An error occured. statfs failed. Did you run h2ph? > > did you run h2ph? check the perl installation instructions for details > on the directories you need to supply h2ph. > > Yes, the INSTALL file said: However, if you're running Linux you may need to run cd /usr/include h2ph *.h sys/*.h asm/*.h ..so that's what I did. -- //Derek Callaway