How to monitor
A status page for your Rails app
Monitor your Ruby on Rails app, API, Sidekiq workers and database, watch SSL expiry, and publish a custom-domain status page — in minutes, with nothing to install.
A Rails app is rarely just the web server: there's the API, Sidekiq (or another job processor), the database, and usually Redis behind it. Each fails on its own. Monitoring them and rolling the results into one status page gives you and your users a clear signal. Here's how — with nothing to install.
What to monitor in a Rails app
- The web app — an HTTP check on your main URL with a keyword assertion.
- The API — a check on a
/healthroute (see how to monitor an API). - Sidekiq workers — heartbeats, so a stalled queue pages you.
- The database & Redis — query/command heartbeats (see PostgreSQL and Redis guides).
- SSL certificate — expiry monitoring (SSL guide).
Add a health route
# config/routes.rb
get "/health", to: "health#show"
# app/controllers/health_controller.rb
class HealthController < ApplicationController
def show
ActiveRecord::Base.connection.execute("SELECT 1") # touch the DB
render json: { status: "ok" }
end
end
Point a StatusCat HTTP monitor at /health with a keyword assertion on "status":"ok". If the database is unreachable, the action raises and the monitor trips.
Monitor Sidekiq with a heartbeat
Add a recurring job that pings StatusCat, so a stalled worker is caught:
# app/jobs/heartbeat_job.rb
class HeartbeatJob < ApplicationJob
def perform
Net::HTTP.get(URI("https://statuscat.co/ping/your-sidekiq-id"))
end
end
Schedule it every few minutes (e.g. with sidekiq-cron). If the ping stops arriving, StatusCat alerts you. (More in how to monitor a cron job.)
Publish the status page
- Group your monitors (web, API, workers, database, Redis).
- Create a status page and add them as components.
- Point it at
status.yourapp.com. - Enable email subscribers for incident updates.
StatusCat does all of this from the outside, free for 50 monitors, with on-call and status pages included. New to monitoring? Start with what uptime monitoring is. On Django or Laravel instead? See status page for Django and status page for Laravel.