[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 100% [Waiting for headers]



On 24/06/12 17:28, lina wrote:
> On Sun, Jun 24, 2012 at 12:49 PM, Chris Knadle <Chris.Knadle@coredump.us> wrote:
>> On Saturday, June 23, 2012 23:49:54, lina wrote:
>>> Kinda of funny,
>>>
>>> Dselect reported me that my /var has saturated.  Indeed, 100%.
>>>
>>> My question is that how to set to let me know earlier when the var reached
>>> 98%.  Kinda of dangerous huh?
>>
>> This is a common problem.  If this is a box you're running KDE on I'd suggest
>> the freespacenotifier package.  If this is a server (or doesn't run KDE) then
> 
> It runs with xfce4.
> 
>> I'd suggest configuring the box such that you'll get email output from cron,
>> and then make a cronjob that outputs text only when the free space left on
>> filesystems reaches the desired "warning" threshold.
> 
> I started to initiate a script,
> 
> $ while [ df -h | grep "/dev/sda11 " | awk '{print $5}' > 90% ]; do
> sleep 1000 ; done mail lina@email.com
> bash: [: missing `]'
> bash: 90%: No such file or directory
> 
> not work.

Here's my quick attempt at a cronjob entry:

* * * * * df -P |grep [9].\%

That will report on _any_ filesystem over 90% - why restrict yourself to
only knowing about some of them?

Firstly, it runs every minute (5 stars), which was useful for testing,
but you probably don't want an email every minute until you fix it :-)
Daily may well be good enough; you could probably just put a file with
"df -P |grep [9].\%" in /etc/cron.daily.

The -P flag makes sure all the info is on one line, which it wouldn't be
on this machine, which has some long device (actually nfs share) names.

The search pattern will find any line with a 9 followed by any character
followed by a % symbol, so anything over 90%. The reason I put the 9 in
[] is to make it easier to add an 8, in case you want to know about
anything more than 80%: [89].\%

I didn't need to escape the % when I ran it from the commandline, but
did from cron. I haven't investigated why. Putting the search pattern in
quotes would probably work too.

It's a bit crude, but probably is good enough.

On the other hand, you could install a proper monitoring system such as
Nagios.

HTH :-)

Richard


Reply to: