Thanks Martin,



That worked.   Specifically, this was the command I used (I ended up having to 
send one env var to PM2):





CHECK PROCESS MyApp MATCHING /data/myApp/index.js

    start program = "/bin/bash -c 'PM2_HOME=/home/ubuntu/.pm2 
/home/ubuntu/bin/pm2 startOrRestart /data/MyApp/package.json'" as uid "ubuntu"

    stop program  = "/bin/bash -c 'PM2_HOME=/home/ubuntu/.pm2 
/home/ubuntu/bin/pm2 stop /data/MyApp/package.json'" as uid "ubuntu"

    if changed pid then alert

On Mon, Mar 23, 2015 at 8:21 AM, Martin Pala <[email protected]>
wrote:

> Hi,
> you can try the pattern based process check provided each nodejs instance in 
> the process table is unique ... you can check the pattern using "monit 
> procmatch" CLI command.
> Regards,
> Martin
>> On 19 Mar 2015, at 15:52, Kristopher Linquist <[email protected]> wrote:
>> 
>> Hi,
>> 
>> I know this question was asked as much as 7 years ago:
>> http://lists.nongnu.org/archive/html/monit-general/2008-08/msg00000.html
>> 
>> I love monit and and am a MMonit user.  I use PM2 to manage my nodejs 
>> scripts and it creates PID files ending in -?  (since when you run Node in 
>> cluster mode, it spawns off several processes and therefore PID files).
>> 
>> The wrapper solution in the FAQ is not ideal for this situation.  I’d love 
>> to use Monit instead of PM2’s paid cloud monitoring solution… if only I 
>> could “monitor service with pid  /var/run/myNodeScript*.pid”  !
>> 
>> -Kris
>> 
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to