Can we monitor the socket states in particular?

Issue #904 new
bharati created an issue

E.g. Can we monitor the socket states in particular like ESTABLISHED, LISTENING, WAITING, CLOSED etc?

Comments (5)

  1. Lutz Mader

    Hello Tildeslash,
    nice idea, a check for the dependent pid is useful also, sometimes.
    You check the port only, but I can not check the port and the process or child process where the port belongs to, I think.

    Lutz

    p.s.
    At the time I use a script with "lsof -i tcp:$port" to check this.

  2. Lutz Mader

    For example, I use the following to check the availability of a Http Server.

    check process Ihs_appl1 with pidfile "/opt/IBM/wlp/servers/appl1/logs/httpd.pid"
      start program "/usr/local/bin/monit/scripts/wlpihs.sh start" with timeout 120 seconds
      stop program "/usr/local/etc/monit/scripts/wlpihs.sh stop" with timeout 120 seconds
      if failed host applhost.local port 8081 for 10 cycles then restart
      if failed host applhost.local port 8081 then alert
      if not exist for 5 cycles then start
      if 5 restarts within 50 cycles then unmonitor
      group Liberty
    

    The port will checked, but Monit does not check the process (the pid) where the used port belongs to. As long as a port is available, the check is valid.
    A check for a hanging port like suggested by bharati seems to me nice also.
    I know the suggested check is useful for local applications only.

    With regards,
    Lutz

  3. Tildeslash repo owner

    Yes, we agree the check for socket states would be useful and may add it in the future.

  4. Log in to comment