Monitoring URLs that test function, not just uptime
A harmless database query catches deeper problems than a ping.
- Answers
- How do you check that a server is actually working, not just online?
- Topics
- cloud · data · iOS · server · watch · web · work
- Full article on willem.com
- https://willem.com/en/2021-02-02_realtime-service-uptime-monitoring/
Summary
I implement special URLs on my web services that run a common but harmless function, such as a simple database query. If that endpoint succeeds, the server is online and the key backend systems respond correctly.
Full text
The simplest uptime check only asks: is it there? If a server does not respond to a request, you know there is a problem. But deeper faults pass that test, because a server can answer while a key system behind it is broken. A more refined setup has multiple checks touching different parts of your infrastructure. I add monitoring endpoints that perform a common function, for example a simple database query. When the test succeeds I know two things at once: the server is online and the database responds correctly. The uptime monitor requests these URLs and verifies the outcome. Design the endpoints to be as efficient as possible. Performing a query is fine, but do not push the server hard, because a monitoring URL gets requested very often.