How to monitor Sidekiq scheduled and cron jobs
Monitor Sidekiq periodic jobs by watching queue latency via the Sidekiq API and the Cron tab in the Web UI, and add an external heartbeat from inside the job as a last line so you're alerted when an expected ping doesn't arrive. Sidekiq queue latency rising means jobs are not draining — usually a dead worker or a blocked queue — and an external heartbeat catches the case where the periodic job was never enqueued at all.
How do I check if Sidekiq workers are running?
Use the Sidekiq API to check queue latency and process count. High latency means jobs are queuing but not being processed — a sign that workers are down or overloaded:
require "sidekiq/api"
# Latency in seconds — how long the oldest job in the queue has been waiting.
puts Sidekiq::Queue.new("default").latency
# Number of running Sidekiq processes.
puts Sidekiq::ProcessSet.new.size
# Jobs in the retry set (failed and waiting to retry).
puts Sidekiq::RetrySet.new.sizeHow do I add a heartbeat to a Sidekiq periodic job?
Ping an external monitor as the last line of the job's perform method. If the job is never enqueued or raises before the ping, no ping arrives and the monitor alerts:
require "net/http"
class NightlyReportJob
include Sidekiq::Job
PING_URL = "https://ping.cronshield.com/<your-check-id>"
def perform
do_the_work
# Report success last. An exception above skips this line.
Net::HTTP.get_response(URI(PING_URL))
end
endWhat if the whole Sidekiq process stops?
If the Sidekiq process dies, no jobs run and no heartbeats fire. A monitor that expected a daily ping will alert when the grace period passes — even if no error was logged. Make sure your process manager (systemd, Foreman, Heroku, Render) restarts Sidekiq automatically, and use the heartbeat to detect the window when it was down.
Add a missed-run alert to this job
The free tier gives you a heartbeat endpoint and an email alert when an expected ping doesn't arrive. Paid tiers add the log-aware diagnosis — the last log line and a likely cause in the alert. The heartbeat receiver ships in an upcoming release; see the plans to learn what each tier adds.
Frequently asked questions
- What is the difference between Sidekiq::Scheduler and sidekiq-cron?
- Sidekiq Enterprise includes a built-in Periodic Jobs feature (Sidekiq::Scheduler). The open-source sidekiq-cron gem adds similar functionality. Both enqueue jobs on a cron schedule, and both fail silently if the Sidekiq process is down.
- How do I monitor Sidekiq queue depth?
- Use Sidekiq::Queue.new(queue_name).size for job count and .latency for the age of the oldest job in seconds. Alert when latency exceeds your acceptable maximum — a spike usually means workers are down.