In some tutorials I've seen the following snippet for monitoring processes with PID:
check process nodejs with pidfile "/var/run/yourprogram.pid"
start program = "/sbin/start myapp"
stop program = "/sbin/stop myapp"
if failed port 8000 protocol HTTP
request /
with timeout 10 seconds
then restart
But in some others I saw monitoring a whole host without PID like the following:
check host localhost with address 127.0.0.1
start "/sbin/start myapp"
stop "/sbin/stop myapp"
if failed port 8000 protocol HTTP
request /
with timeout 10 seconds
then restart
Tell me what is the difference in these two approaches? Which is better for monitoring of node js?