incessant checks on network disconnect

Issue #945 new
js290 created an issue

I tested the “with timeout 30 seconds” by disconnecting the physical network connection on this computer. The openvpn monit check goes haywire. The entire openvpn check ran incessantly; even the process check no longer honored the 5 second timeout. And, the “check network vpn…” with the new timeout value did not seem to help at all. The monit webUI says the start/stop has 30 s timeout, but does not honor it. I have attached the relevant parts of the monit.log.

check process openvpn with pidfile /run/openvpn/protonvpn.pid
  start program = "/bin/systemctl start openvpn"
  stop program = "/bin/systemctl stop openvpn"
  if failed host 9.9.9.9 port 53 type tcp protocol dns retry 5 then stop

check network vpn with interface tun0
  start program = "/usr/bin/monit start openvpn" with timeout 30 seconds
  stop program = "/usr/bin/monit stop openvpn"
  if failed link then restart

See also comments from issue #943

Comments (2)

  1. Tildeslash repo owner

    I think in this scenario it could be good to set the dependency between services. When the parent service is restarted, monit will automatically shutdown the dependant, will wait for the parent to recover and then start the child monitoring again. I think something like this may work better:

    check process openvpn with pidfile /run/openvpn/protonvpn.pid
      start program = "/bin/systemctl start openvpn"
      stop program = "/bin/systemctl stop openvpn"
      if failed host 9.9.9.9 port 53 type tcp protocol dns retry 5 then restart
    
    check network vpn with interface tun0
      depends on openvpn
      if failed link then restart
    

  2. Lutz Mader

    Hello js290,
    a question of understandig, were the logs came from.

    Several of the messages are written with the same timestamp to the log. If I check my logs I find gaps of minutes between the monitor messages because I use a cycle of 60 seconds.

    With regards,
    Lutz

  3. Log in to comment