Xymon Mailing List Archive search

Process needs restart monitor

list Jeremy Laidman
Sat, 2 Jul 2016 10:58:51 +1000
Message-Id: <user-d9029d234bdd@xymon.invalid>

On 22 June 2016 at 02:02, Robert Herron <user-8b27ea4290da@xymon.invalid> wrote:
My Google-fu of the maillist archive is weak and I didn't see anything
relevant on Xymonton.

I have a job pool that is restarted weekly via cron if no jobs are
running.  I would like to be alerted if its process start time is more than
2 weeks ago.

Is there a native way to alert that a process hasn't has been running too
long?  Sort of like the analysis.cfg "UP" check but for a process.
There's nothing out-of-the-box, but the [ps] section of the client data for
many systems shows the "STARTED" column, and could be parsed for the start
time of your process, such as in a server-side script that did like so:

$XYMON $XYMSRV "clientlog $HN section=ps"

Example output can be seen here:

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

Note that not all operating systems have the same "ps" output and so this
technique might only work for some servers.

Hmm, my new xymon-procmem utility uses this very technique to alert on
memory hogs.  It wouldn't take a lot to have it do the same for start time,
although parsing different time/date formats could be challenging to do in
an OS-agnostic way (that is, so that it can run on all/most POSIX Xymon
servers).

Cheers
Jeremy