LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   A work around for monit. Monitoring some ports (https://www.linuxquestions.org/questions/linux-server-73/a-work-around-for-monit-monitoring-some-ports-4175563325/)

g_paschoal 01-07-2016 11:37 AM

A work around for monit. Monitoring some ports
 
Hi Guys, I need some help if possible.

I am using monit to monitor ports 80, 443 and 8008

These ports runs node.js application and they don't have a PID file. So I can't monitor it per PID. That said I could use upstart to create deamon ( but my manager doesn't want that).

So as a work around I have setup it as a remote host, for exemplo

Code:

check host 54.213.234.16 with address 54.213.234.16

# Check port 80
    if failed
          port 80 protocol http
      for 1 times within 1 cycles
      then alert       

# Check port 443
    if failed
          port 443 type tcpSSL protocol http
      for 1 times within 1 cycles
      then alert
     
# Check port 8008
    if failed
          port 8008 protocol http
      for 1 times within 1 cycles
      then alert

This way it works fine for 80 and 443. However port 8008 requires authentication.... so in the monit log I got 401 error.

Code:

HTTP error: Server returned status 401
and monit thinks the process is down. So I don't know what to do here.

dlugasx 01-08-2016 04:53 AM

Quote:

Originally Posted by g_paschoal (Post 5474490)
Hi Guys, I need some help if possible.

I am using monit to monitor ports 80, 443 and 8008

These ports runs node.js application and they don't have a PID file. So I can't monitor it per PID. That said I could use upstart to create deamon ( but my manager doesn't want that).

So as a work around I have setup it as a remote host, for exemplo

Code:

check host 54.213.234.16 with address 54.213.234.16

# Check port 80
    if failed
          port 80 protocol http
      for 1 times within 1 cycles
      then alert       

# Check port 443
    if failed
          port 443 type tcpSSL protocol http
      for 1 times within 1 cycles
      then alert
     
# Check port 8008
    if failed
          port 8008 protocol http
      for 1 times within 1 cycles
      then alert

This way it works fine for 80 and 443. However port 8008 requires authentication.... so in the monit log I got 401 error.

Code:

HTTP error: Server returned status 401
and monit thinks the process is down. So I don't know what to do here.


If You getting error 401 that means that Your port is open and server listen...


All times are GMT -5. The time now is 02:27 AM.