[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting the number of instances of a process

From: Martin Pala
Subject: Re: getting the number of instances of a process
Date: Wed, 2 May 2012 11:04:17 +0200


you can use the test script which will count the processes and return error if 
it doesn't match the expectation.

The script can be something like this (/usr/local/bin/
COUNT=10 #expected count of process instances
if test `ps -ef | grep myprocess | grep -v grep | wc -l` != $COUNT
    return 1
    return 0

and monit configuration something like this:
check program myprocess_count with path /usr/local/bin/
   if status != 0 then alert


On Apr 24, 2012, at 11:07 AM, Lawrence, Wayne wrote:

> Hi 
> i have a basic check that looks like this
>  check process myprocess
>            matching "myprocess"
>            start = "/etc/init.d/myprocess start"
>            stop  = "/etc/init.d/myprocess stop"
> the process concerned doesn't use a pid file but starts a number of identical 
> instances of the process.
> is there any way in monit i can check how many instances of the process are 
> running within a check and alert if it drops below that number?
> Regards
> Wayne
> --
> To unsubscribe:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]