That's a good idea, so I added a tcp port in the app:

resizer.js:

var server = net.createServer(function (socket) {
        socket.end('resizer\n')
});
server.listen(8081, "127.0.0.1");

then monitor it in monit:
(monitrc)

check host resizer with address localhost
        if failed port 8081 type tcp
                then exec "/usr/local/bin/node /home/photos/resizer.js"

but always get this error:
        monit: Cannot translate 'web.com' to FQDN name -- Name or service not
known
        'resizer' failed, cannot open a connection to INET[localhost:8081]
via TCP
        'resizer' exec: /usr/local/bin/node

if it run from command line, node resizer.js, it will work,
 resizer.js seems not able to open a connection if it runs from monit,
any idea? thanks.

On Feb 17, 6:29 am, Tim Caswell <[email protected]> wrote:
> I don't know about monit, but if you start the service with upstart, a
> simple 'restart' directive will auto-restart the process if it dies.  Is
> there some other port you can check on to see if your app is alive?
>
> On Thu, Feb 16, 2012 at 5:05 AM, Angelo Chen <[email protected]>wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I have a simple nodejs that to be loaded by Monit, this app does not
> > have http so this will not work:
>
> > check host resizer with address 127.0.0.1
> >    if failed port 8080 protocol HTTP
>
> > how to check this kind of nodejs app? thanks,
>
> > Angelo
>
> > --
> > Job Board:http://jobs.nodejs.org/
> > Posting guidelines:
> >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to