A keyword monitor requests a URL, just like an HTTP monitor, and then searches the response body for a piece of text. You decide whether the check fails when the text is missing or when it appears. It runs from the regions and at the interval you choose.
When to use it
Use a keyword monitor when "the server answered" isn't enough. A page can return quickly and still be broken: an empty product list, a maintenance banner left up, a framework error page. Checking for text that only appears when things are right, or only when they're wrong, catches those cases.
It still checks a single response. It can't log in, click through a flow or see text that a script adds in the browser after the page loads.
Before you begin
- A public
http://orhttps://URL that returns HTML or JSON. The same address rules apply as for HTTP monitors. URLs that end in a binary or media file extension, such as.pdf,.zip,.jpg,.png,.svgor.mp4, are rejected. - The exact text to look for, copied from the raw response (see What gets searched).
Create a keyword monitor
- Click New monitor and choose Keyword.
- Enter a Name and the URL of the page or API endpoint.
- In Keyword, enter the exact text to look for, up to 500 characters. Spaces at the start and end are removed when the monitor is created.
- Under Alert condition, choose Alert if missing or Alert if present.
- HTTP method starts on GET, in the Request section. HEAD isn't offered for keyword monitors: a HEAD response has no body, so there would be nothing to search.
- Optionally, click Test to run one check now from a probe. It shows Up or Down, so you can see whether the keyword condition passes before you create the monitor. Nothing is saved. See Test before you create. Click Continue.
- Work through SSL & Domain, Settings and Alerts as for an HTTP monitor.
- On the Review step, check that the method is GET, then click Create monitor.
Check that it works
Click View monitor on the Monitor created screen. The SSL Certificate & Domain Expirations card on the monitor page repeats the keyword, so you can confirm it was saved as you typed it. After the first checks, Health Status should read Healthy.
A quick way to prove the condition is the right way round: create the monitor with Alert if missing and a word that you know isn't on the page, and no destinations on the Alerts step (turn Email off and tick Monitor without alerts) so nobody is paged during the test. It should go down after a few checks. Then change the keyword to the real text in URL and request, watch the monitor recover, and add your alert destinations in Alerts.
Choose the alert condition
| Alert Condition | The check fails when… | Use it for |
|---|---|---|
| Alert if missing | The keyword is not found in the response. This is the default. | Text that proves the page works, such as a product name, a footer line or "status":"ok". |
| Alert if present | The keyword is found in the response. | Text that only appears when something is wrong, such as an error message or a maintenance notice. |
Either way, the status code must also pass, as for an HTTP monitor: 200 to 299, or 200 to 399 with Follow redirects on. A 404 or 500 response fails the check whatever the keyword result. So with Alert if present, an error page that comes with a 5xx code already fails on its status code.
In URL and request the same choice is called Keyword must: exist is the same as Alert if missing, and not exist is the same as Alert if present.
Example: expected text
Your shop's home page always shows Free shipping on orders over $50 when the catalogue loads. Monitor https://example.com with HTTP method GET, keyword Free shipping on orders over $50 and Alert if missing. If the catalogue service fails and the page renders without that line, the check fails even though the server answered.
Example: error text
Your application shows Error establishing a database connection when its database is down, but still serves the page. Monitor the page with HTTP method GET, keyword Error establishing a database connection and Alert if present.
What gets searched
LivePulser searches the response body as the server sends it: the raw HTML of a page, including its tags and attributes, or the JSON text of an API response. That's not always what you see in a browser. Before choosing a keyword, look at the raw response and copy the text from there:
curl -s https://example.com/ | grep -o 'Free shipping on orders over \$50'
curl -s https://api.example.com/v1/healthBefore comparing, LivePulser prepares both the body and your keyword in the same way:
- Capitalisation is ignored.
Free Shippingmatchesfree shipping. - HTML entities are decoded, so
&in the page matches&in your keyword, and a non-breaking space matches a normal space. - Any run of spaces, tabs and line breaks counts as a single space. A phrase that wraps over two lines in the HTML still matches.
The keyword is plain text, not a pattern: there are no wildcards or regular expressions. Punctuation and missing spaces still matter. For JSON, an API may return "status":"ok" or "status": "ok", and those are different strings. A tag inside the phrase, such as <b>, also stops it matching. A short, distinctive phrase is more reliable than a long one.
Only the first 2 MB of the body is searched. If a keyword that must be present isn't found in a longer page, the error says so. Compressed responses are unpacked before searching, as long as you don't set your own Accept-Encoding header.
Why a reachable page can still fail
A keyword check can fail while the page loads fine in your browser. The usual reasons are below. When it happens, the incident and alert work as for any other failure: one alert when it starts, a recovery alert when every region passes again. See Incidents and recovery.
| Cause | What to do |
|---|---|
| The text is added by JavaScript after the page loads, so it isn't in the response body. | Pick text that's in the HTML the server sends, or monitor the API the page calls. |
| The text in the HTML differs from what's displayed: a tag inside the phrase, different punctuation, or no space where the page shows one. | Copy the keyword from the raw response, or use a shorter phrase without markup in it. |
| The server returns an error status, such as 403 to unknown clients, even though the text is there. | Check the status in the Server response. Allow requests with the user agent LivePulser-Monitor/1.0, or add the headers the server needs. |
| The URL redirects (for example to a login page or a regional site) and Follow Redirects is off. | Use the final URL, or turn on Follow Redirects in Check settings. |
| The page differs by location, language or A/B test. | Pick text that appears in every variant, or check from fewer regions. |
| The page content changed in a redesign. | Update the keyword in URL and request. |
| The page needs a login. | Send credentials in HTTP Headers, or monitor a public page or health endpoint instead. |
Settings
| Setting | Meaning | Default and limits |
|---|---|---|
| Keyword | The text to search for. | Required. Up to 500 characters. |
| Alert condition | Whether a missing or a present keyword fails the check. | Alert if missing. |
| HTTP method | The request method. | GET for new monitors. HEAD isn't allowed, because it returns no body to search. |
Headers, body, timeout, retries, regions, redirects and SSL checks work exactly as for an HTTP monitor. Domain expiry reminders work the same way too (see Domain and SSL certificates). See Website and API monitoring and the Settings reference. To change the keyword later, open URL and request in the monitor's actions sidebar, edit it and click Save changes.