Closed tpo closed 3 years ago
I retire this feauture request. Two reasons:
/heartbeat # cat config/heartbeat.invalid.yml
base_url: https://robot-ws.your-server.de
basic_auth:
username: valid_username
password: valid_password
failover_ip: 0.0.0.0
ping_ip: 0.0.0.1 # invalid IP address!!!
ips:
- ping: 1.1.1.1
target: 1.1.1.1
- ping: 2.2.2.2
target: 2.2.2.2
interval: 1
timeout: 1
tries: 1
dry: true
only_once: true
and then `grep' heartbeats output for failure:
/heartbeat # HEARTBEAT_LOG=STDOUT bin/heartbeat --config config/heartbeat.invalid.yml | tee /dev/fd/2 | grep "Unable to retrieve the active server ip" && echo && echo "ERROR: Can't access API!"
I, [2021-06-11T07:17:06.472422 #138] INFO -- : Reading configuration from config/heartbeat.invalid.yml.
ping: sendto: Invalid argument
I, [2021-06-11T07:17:06.477612 #138] INFO -- : ping 1/1 of 0.0.0.1 failed
I, [2021-06-11T07:17:07.474778 #138] INFO -- : 0.0.0.1 is down
E, [2021-06-11T07:17:12.503123 #138] ERROR -- : Unable to retrieve the active server ip for 0.0.0.0 from https://robot-ws.your-server.de/failover/0.0.0.0
E, [2021-06-11T07:17:12.503333 #138] ERROR -- : Response from Hetzner Robot API was:
I, [2021-06-11T07:17:12.503468 #138] INFO -- : Not responsible for IP
ERROR: Can't access API!
Actually, the above config snippet could be added to into example/
and mentioned in the README.
I suggest to do an initial Hetzner Robot API check when heartbeat is started.
The reason is: let's assume that your VIP is pinging just fine. Now you will not want to find out that your API access is misconfigured only once the VIP is not pinging fine anymore and you should fail over.
So I suggest to do this:
The stronger version of this would be to periodically check the API, which I think I'd prefer and would propose to make the default behavior:
With this behavior it'd probably be cleaner to move the periodic_api_check into the
check
method itself.