Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

file size monitoring

by skier_kumar (Initiate)
on Sep 03, 2013 at 17:30 UTC ( #1052153=perlquestion: print w/ replies, xml ) Need Help??
skier_kumar has asked for the wisdom of the Perl Monks concerning the following question:

Hey all, Need a help to write a perl script for monitoring the file size which exceeds 1mb in a specific directory. It's urgent request Notes to consider for writing a perl script: * File names are dynamic * Monitoring will be enabled through HP OVO product * Alert has to be configured if any files exceeds 1mb in particular directory. Regards, Sendhil

Comment on file size monitoring
Re: file size monitoring
by MidLifeXis (Prior) on Sep 03, 2013 at 17:49 UTC

    Need a help to write a perl script

    What is your definition of help to write? It appears that your question should read "Need you to write a perl script...".

    Please post any code that you have already written, sample input, expected output, and actual output. Also read Markup in the Monastery (especially the section on <code>...</code> blocks).

    --MidLifeXis

Re: file size monitoring
by kennethk (Monsignor) on Sep 03, 2013 at 17:50 UTC
    What have you tried? What worked? What didn't? We're happy to help design and debug, but we won't do your work for you.

    I'm not familiar with 'HP OVO product' and so don't know the necessary reporting formats, and didn't see any affiliated modules on CPAN. I also don't know what definition of megabyte you are using. I would expect -s will be useful, as will opendir and readdir. That chunk may look something like (untested):

    my $dir = 'somewhere'; opendir my $dh, $dir or die $!; while (my $file = readdir $dh) { print "Too big: $file\n" if -s "$dir/$file" > 1024**2 }

    You may also want to look at File::Find.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Re: file size monitoring
by dave-theunsub (Sexton) on Sep 03, 2013 at 18:45 UTC
Re: file size monitoring
by Laurent_R (Vicar) on Sep 03, 2013 at 18:49 UTC

    If you know the directory, then do I understand right that this is just a matter of checking if any file (possibly with some filename filtering specifications) is growing beyond the 1 MB limit?

    How often do you need to check

    The File::Find module is an option, but for such an easy task (no need to walk through subdirectories, I understand), you might as well write a procedure reading the directory and finding files matching your conditions.

    Ah, yes, as a final question, have you tried something?

    Otherwise, I do not know any thing about the "HP OVO product", if this is important to your question, I may be off-topic.

Re: file size monitoring
by karlgoethebier (Curate) on Sep 03, 2013 at 20:09 UTC

    See HP OpenView for more information/links. Regards, Karl

    Update:

    Using a well know search engine, i found CSOV.

    I didn't use this product and it's expensive but perhaps it's worth to take a look at.

    And perhaps a fellow monk has some experience with this product and likes to say something about it?

    I prefer Nagios and it's splendid fork Icinga for tasks like this.

    «The Crux of the Biscuit is the Apostrophe»

Re: file size monitoring
by jakeease (Friar) on Sep 08, 2013 at 08:58 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (15)
As of 2014-07-31 16:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls