[Xymon] Triggering on total memory?

Jeremy Laidman jlaidman at rebel-it.com.au
Thu Jun 28 11:19:54 CEST 2012


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 <mark+xymon at carnildo.com>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
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20120628/7c38927d/attachment.html>


More information about the Xymon mailing list