I wrote this script not so much as a general-purpose utility but rather as a tool to tell me how much time remains when the proverbial shit hits the fan; How much time I have to work with will have a bearing on what method of solving the problem I choose. (Deleting stale files versus lining up more storage off the SAN, etc.)

DeathClock does a few clever things that may not be immediately recognizable on the surface..

It will attempt to predict when you'll run out of space based on a running average of ($samples) readings. The larger the number of samples, the more accurate the reading will be, but it's not recommended that you use a large value on filesystems where the amount of free space remaining is very volatile. For most purposes, a sample window of about 30 cycles does nicely.

DeathClock will also build up something resembling "confidence" that a panic state is imminent. Right now, I have this value hardcoded to 1 hour, i.e. if DeathClock sees that a filesystem has consistently less than one hour remaining, it will nudge its confidence value ($panicStateDuration) higher and higher until it exceeds the user specified panic threshold value ($panicThreshold).

Once this happens, an email is fired off, a timer is set so that the email recipient isn't bothered for another 10 minutes, and DeathClock continues to monitor the situation. Once the 10 minute window has elapsed, and it still sees a panic-worthy situation, it will fire off another email.

You can set up DeathClock to spit out a single answer:
deathclock.pl /home 30 2 1 0 foo@bar.com

..Or, you can have DeathClock monitor the situation live:
deathclock.pl /home 45 1 0 0 foo@bar.com

Play around with it, you'll see. :)


In reply to Re: DeathClock by bpoag
in thread DeathClock by bpoag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.