Xymon Mailing List Archive search

question

3 messages in this thread

list Matthias Pingel · Mon, 30 May 2016 11:49:25 +0200 ·
Hi,

is it possible to configure a maximum level of memory from a process?

Thanks

Mit freundlichen Grüßen 

Matthias Pingel
list Jeremy Laidman · Thu, 02 Jun 2016 10:01:09 +0000 ·
quoted from Matthias Pingel
On Mon, May 30, 2016 at 10:52 PM <user-4d56554dcd21@xymon.invalid> wrote:
is it possible to configure a maximum level of memory from a process?
Let me rephrase to make sure I understand.  You want to monitor the memory
usage of a process (by name, presumably) and if it exceeds a predefined
threshold, you would like it to change colour?

This is not really possible out-of-the-box.

However, there are ways to do this.  The xymon client data message contains
the "ps" section to list all running processes.  Generally, this includes
memory usage for each process.  So the Xymon server has the data for it to
use.

Example:
https://www.xymon.org/xymon-cgi/svcstatus.sh?CLIENT=claudio.hswn.dk&section=ps

Note that there are several columns you might be interested in here.  An
absolute MB of memory is shown in the resident size (RZ) and virtual size
(VZ), but also the percentage of memory (%MEM).  So, step one is to decide
what you're interested in, perhaps based on what problem you're trying to
detect.

If you wanted to alert on client data, you could write a server-side task
to query every device and do the thresholding.  You could either create a
new test such as "procmem", or you could modify the state of the "proc"
test.  Here's a scriptlet that would probably (untested) do the latter:

#!/bin/sh
PROCMATCH="/usr/sbin/ntpd" # should fetch per-host with hostinfo or
xymongrep
$XYMON $XYMSRV "xymondboard test=proc fields=hostname,client" | grep ",Y$"
| while read LINE; do
    HN=`IFS="|"; set - $LINE; echo $1`
    PS=`$XYMON $XYMSRV "clientlog $HN section=ps" | grep "$PROCMATCH"`
    # parse PS for the appripriate column and generate a "modify" message
for the "prox" status
done

Sorry, I don't have access to a Xymon server to test this with just now.

J
list Paul Root · Thu, 2 Jun 2016 13:00:29 +0000 ·
I wrote a perl script that reads the output of ps, and checks the size of (%mem) of processes defined in a config file. That config file, sets alert levels for yellow and red.  Then run that from cron. It would be pretty easy to run from ext as well.
quoted from Jeremy Laidman


From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Jeremy Laidman
Sent: Thursday, June 02, 2016 5:01 AM
To: user-4d56554dcd21@xymon.invalid; xymon at xymon.com
Subject: Re: [Xymon] question

On Mon, May 30, 2016 at 10:52 PM <user-4d56554dcd21@xymon.invalid<mailto:user-4d56554dcd21@xymon.invalid>> wrote:
is it possible to configure a maximum level of memory from a process?

Let me rephrase to make sure I understand.  You want to monitor the memory usage of a process (by name, presumably) and if it exceeds a predefined threshold, you would like it to change colour?

This is not really possible out-of-the-box.

However, there are ways to do this.  The xymon client data message contains the "ps" section to list all running processes.  Generally, this includes memory usage for each process.  So the Xymon server has the data for it to use.

Example: https://www.xymon.org/xymon-cgi/svcstatus.sh?CLIENT=claudio.hswn.dk&section=ps

Note that there are several columns you might be interested in here.  An absolute MB of memory is shown in the resident size (RZ) and virtual size (VZ), but also the percentage of memory (%MEM).  So, step one is to decide what you're interested in, perhaps based on what problem you're trying to detect.

If you wanted to alert on client data, you could write a server-side task to query every device and do the thresholding.  You could either create a new test such as "procmem", or you could modify the state of the "proc" test.  Here's a scriptlet that would probably (untested) do the latter:

#!/bin/sh
PROCMATCH="/usr/sbin/ntpd" # should fetch per-host with hostinfo or xymongrep
$XYMON $XYMSRV "xymondboard test=proc fields=hostname,client" | grep ",Y$" | while read LINE; do
    HN=`IFS="|"; set - $LINE; echo $1`
    PS=`$XYMON $XYMSRV "clientlog $HN section=ps" | grep "$PROCMATCH"`
    # parse PS for the appripriate column and generate a "modify" message for the "prox" status
done

Sorry, I don't have access to a Xymon server to test this with just now.

J

This communication is the property of CenturyLink and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.