Xymon Mailing List Archive search

Triggering on total memory?

list Jeremy Laidman
Thu, 28 Jun 2012 19:19:54 +1000
Message-Id: <user-9dae9e348bc8@xymon.invalid>

On the server, you can get the total amount of RAM from the "top" client
data like so:

xymon localhost 'clientlog name.of.server section=top' | sed -n '/^Mem:/{s/
total.*$//;s/^.* //;p}'

A client-side script like this should check that the memory is as it should
be:

#!/bin/sh
TEST=ram-check
xymongrep "$TEST:*" | while read LINE; do
  set - ""$LINE; HN="$2"
  [ "$HN" ] || continue
  RAMREQUIRED=`echo "$LINE" | sed "s/^.*${TEST}://;s/ .*$//;s/k$//"`
  HNCOMMAS=`echo "$HN" | sed 's/\./,/g'`
  RAMFOUND=`xymon $XYMSRV "clientlog $HN section=top" | sed -n '/^Mem:/{s/
total.*$//;s/^.* //;s/k$//p}'`
  if [ "$RAMFOUND" -lt "$RAMREQUIRED" ]; then
    COL=red
    MSG="RAM count ${RAMFOUND}kB is less than ${RAMREQUIRED}kB"
  else
    COL=green
    MSG="RAM count ${RAMFOUND}kB is at least ${RAMREQUIRED}kB"
  fi
  echo $XYMON $XYMSRV "status $HNCOMMAS.$TEST $COL `date` $MSG"
done

This script checks any server tagged with "ram-check:NNN" where NNN is a
number of kB" and creates a "ram-check" status page with the result.

J


On Mon, Jun 18, 2012 at 5:25 PM, Mark Wagner <user-faae84d79588@xymon.invalid>wrote:
One of my servers has a quirk where it will occasionally fail to detect
two-thirds of its RAM on startup.  Is it possible to set things up to
send an alert if *total* RAM is below a certain amount?

--
Mark Wagner