Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

File System Monitoring

by NateTut (Deacon)
on May 18, 2009 at 10:59 UTC ( #764630=perlquestion: print w/ replies, xml ) Need Help??
NateTut has asked for the wisdom of the Perl Monks concerning the following question:

I have a new client and one of the first things I need to write is a utility to monitor the file systems on their Unix ETL server. I'm not sure yet what flavor of *Nix it is. I know I can do a df and parse the output, but I don't want to reinvent the wheel. I did a CPAN search but didn't come up with anything that looked helpful.

Comment on File System Monitoring
Download Code
Re: File System Monitoring
by moritz (Cardinal) on May 18, 2009 at 11:07 UTC
    Something like collectd with the DF plugin?

    (Nothing Perl related here, except that collectd allows you to write plugins in Perl).

    (Update: I linked to the wrong plugin first)

Re: File System Monitoring
by wazoox (Prior) on May 18, 2009 at 11:18 UTC
    For a complete monitoring perl-written solution, see munin. It draws nice graphs, too.
Re: File System Monitoring
by targetsmart (Curate) on May 18, 2009 at 11:27 UTC
    AFAIK. Don't depend on df, sometimes it will get updated lately. go for some other alternatives. sometimes if you issue df it won't return immediately

    Vivek
    -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
Re: File System Monitoring
by NateTut (Deacon) on May 18, 2009 at 12:03 UTC
    Thanks all for the tips. That's bad news of df. Are there any alternatives to df? I'm probably going to have to roll my own solution since I'm not an admin on the box.
Re: File System Monitoring
by dHarry (Abbot) on May 18, 2009 at 12:34 UTC

    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

      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?

        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.

        ... or you could try running h2ph as it asks.

        This signature will be ready by Christmas

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://764630]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2014-08-01 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (257 votes), past polls