Skip to content

HTTP checks

An HTTP check is a monitor where CronBeat does the work: instead of waiting for your job to ping, CronBeat requests a URL itself on an interval. Use it for public websites and APIs. For jobs that run on your side, use ping monitors.

Some things have no job that can ping you: a public website, an API, a certificate. CronBeat checks them from the outside, so you learn about an outage even when nobody runs anything on your side.

  • Public websites and APIs that must answer with a given status.
  • Certificates that must be renewed in time.
  • Not for private networks: addresses on private networks are refused, use a ping monitor from inside instead.
  • CronBeat sends a GET or HEAD request (GET is the default) with the user agent CronBeat-HTTP-Check.
  • The check is up when the status code is between 200 and 399. If you set an expected status, only exactly that code counts as up (100 to 599).
  • Redirects are not followed. A 301 or 302 answer is the answer. With the default rule it counts as up; set the expected status if you want to be told when a page starts redirecting.
  • Timeouts are 5 seconds to connect and 10 seconds for the whole request. The response body is read up to 64 KB: it is checked against the text rules if you set any, otherwise discarded.
  • A failed attempt is repeated once after 3 seconds so a single network blip does not raise an alert. Only if the second attempt fails too, the monitor goes down, with the reason failed and a detail such as HTTP 503 or Request failed: ConnectException.
  • The next check is due one interval after the previous one started. Checks run on any of the CronBeat instances, never twice for the same monitor at once.

A status code alone does not prove an application works: a health endpoint can answer 200 and still report "status":"DOWN". Two optional rules look into the response body:

  • Expected text (expectedText): the body must contain this text.
  • Forbidden text (forbiddenText): the body must not contain this text.

Both are case-sensitive, up to 200 characters, and can be combined with each other and with the expected status. They only work with the GET method; saving them with HEAD is refused with 400 Text checks need the GET method. CronBeat reads the first 64 KB of the body, so text that appears only after that is not found.

A failed rule makes the check fail with the detail The response does not contain "..." (expected text missing) or The response contains "..." (forbidden text present). Like every failed check it is repeated once after 3 seconds before the monitor goes down.

Catch the case where the server answers but the content is wrong: a health endpoint that reports a failing component, an error page served with status 200, or a maintenance banner.

  • Health endpoints with a status field. A Spring Boot style endpoint answers {"groups":["liveness","readiness"],"status":"UP"}. Set the expected text to "status":"UP", and the check fails as soon as the status is DOWN, even if the HTTP status is still 200.
  • Pages that must not show a known error message: set it as forbidden text, for example Service Unavailable.
  • Not for large pages where the text sits beyond the first 64 KB, and not for content you would have to match case-insensitively.
Situation Result
The body contains the expected text The check is up (if the status rule passes too).
The body answers {"status":"DOWN"} with HTTP 200 It fails with The response does not contain "..." (your text inside the quotes) and is repeated once after 3 seconds.
It fails again on the second attempt The monitor goes down, an incident opens and channels are alerted.
The body contains the forbidden text It fails with The response contains "...".
The method is HEAD Saving is refused with 400 Text checks need the GET method.
Terminal window
curl -sS -X POST https://api.cronbeat.dev/api/monitors \
-H "Authorization: Bearer cb_pat_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Orders service health",
"scheduleType": "interval",
"intervalSeconds": 60,
"graceSeconds": 120,
"http": {
"url": "https://orders.example.com/actuator/health",
"method": "GET",
"expectedStatus": 200,
"expectedText": "\"status\":\"UP\"",
"forbiddenText": "maintenance"
}
}'

For https URLs CronBeat reads the TLS certificate after a successful check, at most every 6 hours, and keeps its expiry date, issuer and the time it was last read. They show on the monitor page and in the API as httpCertNotAfter, httpCertIssuer and httpCertCheckedAt.

You choose certificate warning days (0 to 90, default 14). CronBeat warns that many days before the certificate expires, and again at 7, 3 and 1 days (only the levels that are not more than your setting). Each level is sent once; after the certificate is renewed the warnings start over. Use 0 to switch the warnings off; the expiry date is still stored.

The warning is not an outage: the monitor stays up and no incident opens. You get a warning message (amber) on the channels of the monitor, and an entry in the app’s notifications. PagerDuty does not receive it. Webhooks get the event monitor.cert_expiring, see Webhooks. Warnings are not sent during a maintenance window, while alerts are suppressed, or for paused monitors.

A certificate that is already expired, not trusted or does not match the host fails the check. The monitor goes down with the reason failed, an incident opens, and the detail says TLS certificate expired on <date>, TLS certificate is not trusted or TLS certificate does not match the host.

Certificate warnings are available on all plans. Checking the domain name registration (domain expiry) is not part of CronBeat.

Setting Rule
URL http or https, up to 2000 characters, no credentials in the URL.
Host Every address it resolves to must be public. Loopback, private ranges, link-local, carrier-grade NAT, unique-local IPv6, multicast and 0.0.0.0 are rejected. Checked when you save and again before every request.
Interval At least the minimum interval of your plan (5 minutes on Free, 1 minute on Pro and Enterprise).
Grace period At least 60 seconds.
Schedule Interval only. Cron schedules and a maximum runtime do not apply.
Texts expectedText and forbiddenText: optional, case-sensitive, up to 200 characters, GET only.
Kind The kind of a monitor cannot be changed later. Create a new monitor to switch between ping and HTTP check.

HTTP checks count toward your monitor limit like every other monitor, see Plans and limits.

Paused monitors are not checked. Monitors inside an active maintenance window are not checked either. Recovery works like for pings: the first successful check closes the open incident and sends a recovery message, see Incidents and reminders.

Terminal window
curl -sS -X POST https://api.cronbeat.dev/api/monitors \
-H "Authorization: Bearer cb_pat_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Marketing site",
"scheduleType": "interval",
"intervalSeconds": 300,
"graceSeconds": 120,
"http": {"url": "https://example.com/", "method": "GET", "expectedStatus": 200, "sslWarnDays": 14}
}'

See the REST API for all fields.

Situation Result
The site answers 503 once and 200 three seconds later Nothing. The failed attempt is repeated once after 3 seconds.
It fails twice in a row The monitor goes down with a detail like HTTP 503, an incident opens and every channel gets an alert.
The certificate expires in 5 days and the warning is 14 days The monitor stays up. You get a warning message at 14, 7 and 3 days, no incident opens. Renewing the certificate resets the warnings.
The certificate has expired or is not trusted The check fails, the monitor goes down with TLS certificate expired on <date> (or is not trusted, does not match the host) and an incident opens.
The site redirects to another address The redirect is not followed. A 301 counts as up unless you set an expected status.
The URL resolves to a private address The check fails with Address is not allowed.
The monitor is paused or in maintenance No requests are sent.
Your plan gets a longer minimum interval The interval of the check is lengthened to that minimum. Ping monitors keep their interval.