Welcome to Pandora FMS Community!

Find answers, ask questions, and connect with our community around the world.

  • MemFree is misleading

    Posted by senjor on April 8, 2011 at 20:46

    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 ?

    daniels replied 13 years, 7 months ago 3 Members · 5 Replies
  • 5 Replies
  • miguel

    Member
    April 11, 2011 at 10:12
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi.

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

    Bye.

  • miguel

    Member
    April 11, 2011 at 10:40
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi again.

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

    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.

  • senjor

    Member
    April 11, 2011 at 14:29
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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.

  • miguel

    Member
    April 11, 2011 at 16:16
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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.

  • daniels

    Member
    May 17, 2011 at 22:19
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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.