keepcalculator

06 Numbers and Powers

Uptime Monitoring: Catch API Errors & Missed Cron Runs

Card No. 06·41243 · Updated · Standard formula, shown below

Yes, SaaS uptime monitoring can catch API errors and missed cron runs, but only if you configure it to do so. Standard uptime checks only verify that a server responds, while API error detection requires checking response bodies and status codes, and cron monitoring requires heartbeat or ping-based checks. This article explains how to set up both, what to watch for, and how to avoid common pitfalls.

What Uptime Monitoring Actually Checks

Traditional uptime monitoring sends a request to a URL and expects a response within a timeout. If the server doesn’t respond, it’s marked down. This catches complete outages, but it misses many real problems:

  • API returning 500 errors – the server is up, but the endpoint is broken.
  • API returning 200 with an error payload – e.g., {status: "error"} in the JSON body.
  • Cron job that runs but fails silently – the script exits with a non-zero code, but no one notices.
  • Cron job that never runs – the scheduler is down, or the job was disabled.

To catch these, you need more than a basic TCP or HTTP check.

How to Monitor API Errors

API monitoring typically involves sending a request to an endpoint and asserting on the response. Most uptime services support this through:

  • HTTP status code checks – alert if the response is not 200, 201, etc.
  • Response body validation – check for a specific string or JSON field (e.g., "success": true).
  • Response time thresholds – alert if the API is slow, which often precedes failures.
  • Multi-step transactions – simulate a login, then a data fetch, to catch auth-related errors.

For example, if you have a REST endpoint /api/users, you can configure a check that expects a 200 status and a JSON body containing "status":"ok". If the endpoint returns a 500 or a different JSON, you get an alert.

How to Monitor Missed Cron Runs

Cron jobs don’t have a URL to hit, so you need a different approach: heartbeat monitoring or ping-based monitoring. The idea is simple:

  1. At the end of your cron job, send an HTTP request to a unique URL provided by your monitoring tool (e.g., https://uptime.example.com/ping/your-job-id).
  2. The monitoring tool expects that URL to be hit at a set schedule (e.g., every 15 minutes).
  3. If the ping doesn’t arrive on time, the tool alerts you.

This catches both missed runs and crashes. Some tools also support cron status codes – you can send a success or failure signal, so you know not just that the job ran, but whether it succeeded.

Choosing the Right Tool

Not all uptime monitors support these features. When evaluating a tool, look for:

  • API checks – ability to set expected status codes and body content.
  • Heartbeat monitoring – also called “cron monitoring” or “ping monitoring.”
  • Alerting flexibility – email, Slack, SMS, webhooks.
  • Retry logic – to avoid false alerts on transient network issues.
  • Status pages – if you need to show uptime to customers.

Popular tools include Pingdom, UptimeRobot, Better Uptime, and Cronitor. Some are free with limits, others are paid. Choose based on your volume of checks and alerting needs.

Common Pitfalls and Misconceptions

Here are a few mistakes people make when setting up monitoring:

  • Only checking the homepage – your homepage might be fine while your API is broken. Monitor every critical endpoint.
  • Ignoring response time – a slow API can be worse than a down one. Set thresholds.
  • Not testing error paths – if your API returns a 500, does your monitoring catch it? Test by temporarily breaking an endpoint.
  • Heartbeat URL not unique – if you use the same ping URL for multiple jobs, you can’t tell which one failed.
  • Not setting up alerts properly – if you only have email and you don’t check email, you’ll miss alerts. Use multiple channels.

Comparing Uptime Monitoring vs. APM vs. Logging

Uptime monitoring is not the only tool. Here’s how it fits with others:

  • Uptime monitoring – checks from outside, simulates user requests, catches outages and API errors.
  • APM (Application Performance Monitoring) – instruments your code, tracks request traces, database queries, and internal errors. Catches issues that don’t affect external probes.
  • Logging – records errors and events, but only if you look at them. Good for post-mortems, not for real-time alerts.

For a robust setup, use uptime monitoring for external visibility, APM for internal performance, and logging for detailed debugging. They complement each other.

Cost and Complexity

Costs vary widely. Basic uptime checks can be free for a small number of monitors (e.g., UptimeRobot offers 50 free monitors). API checks and heartbeat monitoring often require a paid plan, starting around $10–$20 per month for small teams. Enterprise features like multi-location checks, advanced alerting, and status pages cost more.

Complexity also scales. A simple cron job with a heartbeat ping is easy to add – just a few lines of code. But if you have hundreds of endpoints and jobs, you’ll need to organize your checks, manage alert fatigue, and maintain your monitoring configuration as your infrastructure changes.

Frequently Asked Questions

Can uptime monitoring catch a cron job that runs but fails halfway?

Yes, if you send a success signal only at the end of the job. If the job fails midway, the success ping won’t be sent, and the monitor will alert. Some tools also let you send a failure signal explicitly.

What is a heartbeat URL?

A unique URL that your cron job pings after it finishes. The monitoring service expects that URL to be hit at regular intervals. If it isn’t, you get an alert. It’s a simple way to confirm a job ran.

How often should I check my API?

It depends on your criticality. For most APIs, every 1–5 minutes is common. For very critical systems, you might check every 30 seconds. Keep in mind that each check sends a request, so too frequent checks can add load.

Can I monitor internal APIs that aren’t public?

Yes, if the monitoring tool can reach them. You can use a VPN, a reverse proxy, or install an agent inside your network. Some tools offer private location agents that run inside your infrastructure.

What’s the difference between a ping check and an HTTP check?

A ping check uses ICMP to see if a server is reachable. An HTTP check sends a real HTTP request and can validate status codes and response bodies. For APIs, always use HTTP checks.

Do I need a separate tool for cron monitoring?

Not necessarily. Many uptime services now include heartbeat monitoring. But dedicated cron monitoring tools like Cronitor or Healthchecks.io offer advanced features like retries, schedules, and integration with job runners. Choose based on your needs.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →