Create a Health Check URL in Your Web App and Monitor Its Uptime
In this video, we'll go over how to set up a health check endpoint in Flask and use the free UptimeRobot service to monitor your uptime.
After watching this 5 minute video you’ll know how to create a custom health check endpoint in your app that double checks your database connection and also get notified by email from a free monitoring service if your site ever happens to go down.
# Demo Video
Timestamps
- 0:35 – Creating a health check endpoint in a Flask app
- 2:41 – UptimeRobot (free) monitors and notifies you by email if your site goes down
Code
An example of creating a minimal /healthy
health check endpoint in Flask
which also checks your database to make sure it’s able to be connected to.
@page.route('/healthy')
def healthy():
db.engine.execute('SELECT 1')
return ''
Reference Links
- https://buildasaasappwithflask.com
- https://uptimerobot.com
- https://runninginproduction.com/tags/uptime-robot
How do you have your health check endpoint set up? Let me know below.