I’m trying to use Use Uptime Tests with Target URL, but I don’t know exacly how it works…
I add uptime tests that match the URL in upstream targets.
Tyk will create a list of all failed uptime-test hosts. If one upstream target matches a host on the list, it will skip this host? Does this always have to match? Because my upstream target may be http://host, but there is no page so I would have to create a test against http://host/core.
Is it possible to see the current ‘down’-host list somehow?
You basically set up a bunch of test URLs for your service, e.g.:
POST http://host0/service/example-widget/1111
POST http://host1/service/example-widget/1111
POST http://host2/service/example-widget/1111
And then Tyk will ping those hosts for you with those requests and payloads, now you don;t need to always have the same host, or the same endpoint, you could set up a test for all of your services and Tyk willg enerate an uptime chart of the latency and availability for you.
To know when a host is down, you need to hook into the HostDown event, which fires if a URL starts to fail.
If you are using the load balancer, then you can enable an option for Tyk to link the two and remove the hostname from the loadbalancer so that no more traffic hits that hostname until the uptime tet passes again.
Yes
If you want them to be linked, the hostnames must match, not the URLs
This would work
You would need to hook into the HostUp and HostDown events which can generate a webhook or run some JS.
Before trying to get the LB to work, you should probably check your gateway logs to make sure the host checker is active (it should be), you should also see error logs when the host is detected as down and up again. If you can see these, then the host checker is working properly.
Once you.ve confirmed that, then try the uptime link with the LB.