How to Set Up Alerts That Warn You Before Visitors Notice
Website uptime alerting setup is not about adding a monitor and walking away. It is about deciding what "down" means for each service, measuring it from somewhere that is not your own network, and routing the result to a human who can act, with thresholds tight enough to catch real trouble and loose enough that a single slow response does not wake anyone. The first two sentences of your alert design should answer two questions: what exactly is being checked, and who is told when it fails.
Most false alarms come from checking the wrong thing. A TCP connect to port 443 tells you the kernel accepted a socket. It does not tell you the application served a page. A ping tells you the host is reachable, which is nearly useless for a web service. Check the layer your visitors actually depend on: an HTTP request to a URL that exercises the app, the database, and the template rendering, and assert on both the status code and a string in the body.
Pick a check that fails for the right reasons
An HTTP check should set an explicit User-Agent, follow no redirects unless you expect them, and match a known marker. Here is what a manual probe looks like, the same shape your monitor should use:
curl -sS -o /dev/null -w '%{http_code} %{time_total}\n' \
-A 'uptime-probe/1.0' \
--max-time 10 \
https://example.com/health
# 200 0.213
Note the --max-time: without it a hung connection can hold the check open far longer than a visitor would wait. Ten seconds is generous for a health endpoint. If your app takes longer than that to answer a simple query, that is itself the incident.
Prefer a dedicated /health route that returns a small body only after touching its dependencies, and keep it cheap so it can be polled often. Return a non-200 status when a dependency is unreachable. Do not put the health route behind authentication, and do not let it trigger writes or cache invalidation.
Set thresholds that match how the service fails
A single failed check is noise. The default should be "fail from two or more locations, twice in a row" before you page anyone. Geography matters: if you check from one region and that region has a routing problem, you will page yourself for an outage that only you can see. Multi-location confirmation removes most of that.
Latency alerts need a different shape from availability alerts. Do not alert on a single slow response. Alert on a sustained shift, for example when the median response time over several minutes exceeds a level you have measured during normal traffic, or when the error rate crosses a small absolute count. If your monitor supports it, express this as a query rather than a fixed number:
# alert when 5xx responses exceed a small absolute count
# over a short window, evaluated per check location
sum(rate(http_requests_total{code=~"5.."}[5m])) > 3
Absolute counts age better than ratios when traffic is low, because a percentage of a tiny denominator swings wildly. Pick numbers from your own logs, not from a blog post.
Route alerts to the person who can fix it
Every alert needs an owner and a channel. Send availability pages to whoever is on call, and send performance warnings to a channel people read during working hours. If everything goes to one inbox, people start filtering it, and then nothing gets through.
Use a webhook so the alert lands where the work happens. Most monitoring tools will POST a JSON body you can shape. Keep the payload small and put the useful facts in fixed fields: the check name, the URL, the status, the failing location, and a link to the check's history.
curl -sS -X POST https://hooks.example.internal/alerts \
-H 'Content-Type: application/json' \
-d '{"service":"web","status":"down","location":"eu-west","url":"https://example.com/health"}'
If your monitor supports a custom request header, add one so the receiving system can route without parsing the body, for example X-Alert-Severity: page for outages and X-Alert-Severity: ticket for slow trends. Test the webhook by hand before you trust it, and confirm the receiving side returns a 2xx. A silently failing webhook is worse than no alert, because you believe you are covered.
Control noise before it controls you
The fastest way to lose trust in alerting is to page on the same problem repeatedly. Configure a repeat interval and a recovery notice. When a check recovers, send one message saying so, and suppress the paging channel until it does. If a dependency flaps, group related checks so one incident produces one page, not one per URL.
Review your alerts after every incident. For each page, ask whether it fired early enough to matter and whether it was actionable. Delete or downgrade any alert that has not led to an action in recent memory. An alert nobody acts on is a habit, not a signal.
Put your check definitions under version control alongside the app. A small file per service, with the URL, the expected status, the timeout, the confirmation count, and the routing target, makes the setup reviewable and reproducible when you add the next service.
What to do next
Start with one check against a health endpoint you control, run it from two locations, and require two consecutive failures before paging. Route it to a channel you actually watch, then break the endpoint on purpose and confirm the page arrives and the recovery message follows. Once that loop works, add latency and error rate checks from your own logs, and keep the thresholds honest by revisiting them after each incident.
