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

Re: When ram memory is critical ?



[Sorry for the toppost, but I can't be arsed to edit the
already-buggered quoting]

I'm not sure why you'd want to warn about systems using the full
resources you've provisioned them with, but if you are going to, you
probably want to make the test as light-weight as possible as you'll
presumably be repeating it frequently.

The output of "free" is fairly stable and unlikely to change. You want
the 3rd line, 3rd field (memory used)

<pre>
user@host:~$ free -m | awk 'NR==3{print $3}'
95
</pre>

But that requires modification for each different server you
provision. Why not monitor the amount /unused/ and then spam your
phone at 3am when cron kicks off?

<pre>
user@host:~$ free -m | awk 'NR==3{print $4}'
392
</pre>

But even if the tool output weren't stable, and you still had to
pattern match to discover the line you wanted, you could still avoid a
seperate grep process as awk can do it all:

<pre>
user@host:~$ free -m | awk '/buffers\/cache/{print $4}'
392
</pre>

Regardless, I suggest you *collect*, *graph* and *trend*  these
values, but don't alert or warn based on them. On the other hand, you
may dislike a good night's sleep.

Jonathan

On 8 April 2011 22:08, Ron Johnson <ron.l.johnson@cox.net> wrote:
>
> It should be '{print $3}'.
>
> $ free -m
>          total     used     free     shared    buffers     cached
> Mem:       8059     6249     1810          0         20       3485
> -/+ buffers/cache:  2743     5316
> Swap:     15624      139    15485
>
>
> $ free -m | grep buffers/cache | awk '{print $3}'
> 2743
>
>
> On 04/08/2011 03:59 PM, Fabio DellaCorte wrote:
>>
>> So i think the correct thing to do is  "free -m | grep buffers/cache | awk
>> '{print $4}" is right for me to place a warning system that monitors the
>> RAM
>> .
>>
>> 2011/4/8 Ron Johnson<ron.l.johnson@cox.net>
>>
>>>
>>> The actual "used by kernel+applications" is, I think, 371.
>>>
>>>
>>> On 04/08/2011 02:53 PM, Fabio DellaCorte wrote:
>>>
>>>> OK! Thank you for the explanations. But raising this case, what is the
>>>> parameter to be controlled? And compared to the controls I mentioned
>>>> above which
>>>> of the two actually fit the occupation of RAM ?
>>>> 2011/4/8 Stan Hoeppner<stan@hardwarefreak.com>
>>>>
>>>>  Fabio DellaCorte put forth on 4/8/2011 12:13 PM:
>>>>>
>>>>>> root@debian-cq2:/etc/pandora# free -m
>>>>>>              total       used       free     shared    buffers
>>>>>> cached
>>>>>> Mem:          8006        790       7215          0        210
>>>>>>  208
>>>>>> -/+ buffers/cache:        371       7634
>>>>>> Swap:        22883          2      22881
>>>>>>
>>>>>
>>>>> You have 7GB+ free out of 8GB.  And you're concerned with memory usage?
>>>>>  LOL
>>>>>
>>>>> Why do you have 20GB of swap?  Given your memory usage, assuming the
>>>>> above is "typical", and the fact you have 8GB RAM, I'm going to guess
>>>>> you could likely get by with no swap device at all.
>>>>>
>>>>> You have nothing to worry about.  Unless of course this is an "idle"
>>>>> state, and you run some gargantuan simulation app that eats all 8GB
>>>>> when
>>>>> launched.  I doubt that's the case, as you'd not be asking this
>>>>> question
>>>>> if you used such an app.
>>>>>
>>>>>>  From what you've provided, you don't need to worry about memory.
>>>>>
>>>>>
>>> --
>>> "Neither the wisest constitution nor the wisest laws will secure
>>> the liberty and happiness of a people whose manners are universally
>>> corrupt."
>>> Samuel Adams, essay in The Public Advertiser, 1749
>>>
>
> --
> "Neither the wisest constitution nor the wisest laws will secure
> the liberty and happiness of a people whose manners are universally
> corrupt."
> Samuel Adams, essay in The Public Advertiser, 1749
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject
> of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: 4D9F7936.3000601@cox.net">http://lists.debian.org/4D9F7936.3000601@cox.net
>
>



-- 
Jonathan Matthews
London, UK
http://www.jpluscplusm.com/contact.html


Reply to: