Pages: [1]   Go Down
Author Topic: MemFree is misleading  (Read 692 times)
0 Members and 2 Guests are viewing this topic.
senjor
Jr. Member
**

Karma: 0
Offline Offline

Posts: 20


View Profile
« on: April 08, 2011, 05:46:26 PM »

Hello everybody ,
i've started the memfree alarm for a debian agent . I noticed that alarm is triggered although i see only a few process on server .
I think that command in agent is not correctly : "cat /proc/meminfo | grep MemFree | awk '{ print $2 }'" because memory management in linux is not critical if this value is low .

I suggest "free -m | grep buffers/cache | awk '{print $4}'"

What do you think ?
Logged

miguel
Global Moderator
Sr. Member
*****

Karma: 0
Offline Offline

Posts: 102



View Profile
« Reply #1 on: April 11, 2011, 07:12:23 AM »

Hi.

Ok. I send your information to my jobmates for to study and they will made the changes.

Bye.
Logged

miguel
Global Moderator
Sr. Member
*****

Karma: 0
Offline Offline

Posts: 102



View Profile
« Reply #2 on: April 11, 2011, 07:40:54 AM »

Hi again.

I test in my machine with run a virtualbox (this program use much memory) and without this program:

Code:
md@speccy:~$ cat /proc/meminfo | grep MemFree
MemFree:           33120 kB
md@speccy:~$ cat /proc/meminfo | grep MemFree
MemFree:         1274172 kB
md@speccy:~$

And the value go down when the machine have less memory.
Logged

senjor
Jr. Member
**

Karma: 0
Offline Offline

Posts: 20


View Profile
« Reply #3 on: April 11, 2011, 11:29:56 AM »

What I'm trying to say although my English is not the best, is that the value you are seeking is not a critical situation.
Logged

miguel
Global Moderator
Sr. Member
*****

Karma: 0
Offline Offline

Posts: 102



View Profile
« Reply #4 on: April 11, 2011, 01:16:13 PM »

Ok. I have talk with jobmates and you are right. Because the memory in GNU/Linux is management in other priorities and the system may take all memory but it is free.

I have add this changes in the "Pending Task" tracker of project in the SourceForge:

https://sourceforge.net/tracker/?func=detail&aid=3284422&group_id=155200&atid=1226163

But at the moment you could change the line for you correct line in your system.

Thanks.
Logged

daniels
Smart member
*****

Karma: 19
Offline Offline

Posts: 205



View Profile
« Reply #5 on: May 17, 2011, 07:19:47 PM »

Hi guys.

  I use this modules to monitor the memory, and they are pretty usefull to me.

-----------------------------------------------------------------------------------------------
# Memory Session
module_begin
module_name memfree
module_type generic_data
module_exec free |grep "buffers/cache" | awk {'print $4'}
module_description Free memory
module_end

module_begin
module_name memused
module_type generic_data
module_exec free |grep "buffers/cache" | awk {'print $3'}
module_description Used memory
module_end

module_begin
module_name mem_comm
module_type generic_data
module_exec cat /proc/meminfo | grep "Committed_AS:"  | awk '{ print $2 }'
module_description Commited memory
module_end

module_begin
module_name mem_swpin
module_type generic_data
module_exec cat /home/pandora/swp.txt |grep "Average" | awk '{ print $2 }'
module_description Total swap pages in per second
module_end

module_begin
module_name mem_swpout
module_type generic_data
module_exec cat /home/pandora/swp.txt |grep "Average" | awk '{ print $3 }'
module_description Total swap pages out per second
module_end
-----------------------------------------------------------------------------------------------

My alerts are set based on sar -W (for page faults). This is used when the memory is over and the system starts to swaping (using virtual memory).


The script I use to run sar and generate the swp.txt is cpu.sh:

-----------------------------------------------------------------------------------------------
#!/bin/bash
# Versao 1.0
# Script para recuperar a media de processamento
# dos ultimos 5 minutos.
MIN=$(date +%M)
HOR=$(date +%H)
MSA=$(date -d "5 minutes ago" +%M)
HSA=$(date -d "5 minutes ago" +%H)
CPU=$(echo "/home/pandora/cpu.txt")
SWP=$(echo "/home/pandora/swp.txt")

# O script repete o ultimo valor obtido a meia noite
if [ $HOR -eq 0 ] && [ $MIN -lt 5 ]; then
        #Nao atualiza os arquivos cpu e swp e finaliza script
        cat $CPU
        exit
fi

# Ajuste para uso do sar com valores com 2 digitos
INICIO=$(printf "%s:%s:00" $HSA $MSA)
FIM=$(printf "%s:%s:00" $HOR $MIN)

sar -s $INICIO -e $FIM > $CPU
sar -W -s $INICIO -e $FIM > $SWP
cat $CPU
-----------------------------------------------------------------------------------------------

I call the script at the first module in pandora, so the result in cpu.txt and swp.txt are ready for the other modules.

-----------------------------------------------------------------------------------------------
# SAR Session
module_begin
module_name cpu_sar_user
module_type generic_data
module_exec /home/pandora/cpu.sh | grep Average |awk '{ print $3 }'
module_description CPU sar used by Users
module_end
-----------------------------------------------------------------------------------------------


This script has a flaw for the first value of the day, but this is not a problem to me.

I hope this helps. Sorry for the loooong post ;-)

Regards.
Logged

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST