Re: Need help to setup monit for Prerender service

Bhuvan Gupta <[email protected]>
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <CAF4ab9Wyfw8ozrhvzF2akSgvK0xX9Oh_Kk4VTcazjMKZsDEC3Q@mail.gmail.com>
Apoorwa,

Just be cautious that using script directly in monit file has this syntax

stop = "/bin/bash -c 'kill -s SIGTERM `cat /var/run/process.pid`'"

references https://mmonit.com/monit/documentation/monit.html

Also starting with nohup and using echo$! in  centos might have a problem.

See this:

Check this mail thread:

https://lists.nongnu.org/archive/html/monit-general/2017-08/msg00017.html


On Mon, Aug 28, 2017 at 10:40 PM, Apoorwa Sharma <[email protected]>
wrote:

> Thanks *Guillermo let me try this.*
>
>
>
> *Apoorwa Sharma*
> Sr.  Devops Engineer, Minjar Cloud Solutions
> [email protected] | www.minjar.com |
>
>
>
>
> On Mon, Aug 28, 2017 at 10:32 PM, Guillaume François <
> [email protected]> wrote:
>
>> Hi,
>>
>> Hum, did you send the email before review it ?
>>
>> Anyway, let's try to help you.
>>
>> A NodeJS javascript file is not a PID file. So this won't ever work.
>>
>> You have to run you process in a way to keep track of the pid like:
>>
>> nohup node /home/centos/prerender/server.js > /dev/null 2>&1 & echo $! > /var/run/my-nodejs-server-pid-file.pid
>>
>> then use this PID file in monit configuration with somethink like below
>>
>> check process Prender with pidfile /var/run/my-nodejs-server-pid-file.pid
>>     start program = "nohup node /home/centos/prerender/server.js > /dev/null
>> 2>&1 & echo $! > /var/run/my-nodejs-server-pid-file.pid"
>>     if cpu usage > 90% for 10 cycles then restart
>>
>> Best would be to use a wrapper script instead of the full command line
>> also.
>>
>> Hopes this help mister "Sr. Devops Engineer"
>>
>>
>>
>>
>> 2017-08-28 18:37 GMT+02:00 Apoorwa Sharma <[email protected]>:
>>
>>> Hi,
>>>
>>> I Need help to setup monit for Prerender service I am trying now
>>>
>>> check process Prender with pidfile /home/centos/prerender/server.js
>>>     start program = "nohup node server.js > /dev/null&"
>>>     if cpu usage > 90% for 10 cycles then restart
>>>
>>>
>>>
>>> *Apoorwa Sharma*
>>> Sr.  Devops Engineer, Minjar Cloud Solutions
>>> [email protected] | www.minjar.com |
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe:
>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>>
>>
>>
>>
>> --
>> -----BEGIN GEEK CODE BLOCK-----
>> Version: 3.1
>> GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o--
>> K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-?
>> b(-) DI !D- G(+)>+ e+++ h--() r->$ y?*
>> ------END GEEK CODE BLOCK------
>>
>> --
>> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.