0

I have HAPproxy configuration with two servers:

listen 10.10.10.10
        bind *:1234
        mode tcp
        option tcplog
        balance roundrobin

        timeout client  5h
        timeout server  5h

        option external-check
        option log-health-checks
        external-check path "/var/lib/haproxy/dev"
        external-check command /var/lib/haproxy/dev/testscript.sh
        external-check command /bin/true
        server nodo1-1 192.168.1.14:1234 check inter 30s fall 1 rise 1
        server nodo1-2 192.168.1.15:1234 check inter 30s fall 1 rise 1

But the command doesn't execute every 30 seconds.

ccelis5215
  • 1
  • 1
  • 2

1 Answers1

0

Your "path" is very limited. Your testscript.sh can only run commands on that path or fully specified. Remove the "external-check command /bin/true".

Gerard H. Pille
  • 2,569
  • 1
  • 13
  • 11
  • remove the "external-check command /bin/true". After restart the script just execute once at restart time.Sep 7 06:50:39 vMega-HA haproxy[16656]: Proxy stats started. Sep 7 06:50:39 vMega-HA haproxy[16656]: Proxy 192.168.1.220 started. Sep 7 06:50:39 vMega-HA haproxy[16656]: Proxy 192.168.1.220 started. Sep 7 06:50:39 vMega-HA haproxy[16658]: Health check for server 192.168.1.220/nodo1-1 succeeded, reason: External check passed, code: 0, check duration: 10ms, status: 1/1 UP. It doesn't repeat at 30 seconds interval.. – ccelis5215 Sep 07 '18 at 11:00
  • inter expects a delay in milliseconds, not a time value which you could express as "30s". So you need "inter 30000". – Gerard H. Pille Sep 07 '18 at 12:09
  • No, it doesn't work. The script just execute once and leave the nodes up. I am going to take a different approach. Thanks for your help. – ccelis5215 Sep 07 '18 at 13:44