[rabbitmq-discuss] of queues, memory and heartbeats...

Anthony anthony-rabbitmq at hogan.id.au
Wed Sep 2 13:09:57 BST 2009


Hi Ben,

The rabbit_memsup_linux module parses these values out of /proc/meminfo:
> 'MemTotal', 'MemFree', 'Buffers', 'Cached'
> such that
> MemUsed = MemTotal - MemFree - Buffers - Cached
>

Thanks for that..

Hacked up the following script for Nagios so I could keep an eye on memory
approaching threshold..

#!/bin/bash

STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4

MEMTOTAL="`grep "^MemTotal: " /proc/meminfo |\
        awk '{print $2}'`"

MEMFREEEQN="`egrep "^(MemTotal|MemFree|Buffers|Cached):" /proc/meminfo |\
        awk '{print $1 " " $2}' |\
        sed -r 's/^MemTotal:/+/g
                s/^(MemFree|Buffers|Cached):/-/g'`"

MEMFREE="$(( ${MEMFREEEQN} ))"
MEMPCFREE="$(( ( ${MEMFREE} * 100 ) / ${MEMTOTAL} ))"

MEMPCFREECRIT=5
MEMPCFREEWARN=10

if [ ${MEMPCFREE} -gt ${MEMPCFREEWARN} ]; then
        echo "OK: ${MEMFREE} (${MEMPCFREE}%) > ${MEMPCFREEWARN}% free"
        exit $STATE_OK
elif [ ${MEMPCFREE} -gt ${MEMPCFREECRIT} ]; then
        echo "WARNING: ${MEMPCFREECRIT}% < ${MEMFREE} (${MEMPCFREE}%) <
${MEMPCFREEWARN}%"
        exit $STATE_WARNING
elif [ ${MEMPCFREE} -le ${MEMPCFREECRIT} ]; then
        echo "CRITICAL: ${MEMFREE} (${MEMPCFREE}%) <= ${MEMPCFREECRIT}%"
        exit $STATE_CRITICAL
fi

echo "UNKNOWN: Something went awry!"
exit $STATE_UNKNOWN

This'll let me go hunt down issues before they start causing throttle
problems. In the event others are interested, this is the quick check I use
to see if AMQP daemon is contactable in Nagios...

define command{
        command_name    check_amqp
        command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p 5672 -d 1 -E
-s 'AMQP\r\n\r\n\r\n' -e 'AMQP'
        }

(Wait 1 second, send "AMQP" followed by three EOL sequences and expect the
string "AMQP" returned)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090902/3fcc4750/attachment.htm 


More information about the rabbitmq-discuss mailing list