How it Works
Creating a Single URL Monitor With CLI Constructs
Checkly’s Monitoring as Code workflow starts with creating a project where all your checks will be stored. You can use Checkly constructs to describe new Checkly monitors within your Checkly dashboard. If you haven’t worked with Checkly at all, or have only created new monitors from our web UI, install the Checkly CLI and create a new project for our checks with our getting started guide here. A basic URL monitor with minimal configuration looks like this:- Each monitor needs a unique logical ID. By matching this ID we can update an existing monitor without deleting its history.
- Except for the
request
object, logical ID, and name, every other configuration of a URL monitor can be defined either:- Individually on that single monitor
- As part of a group of monitors
- By using defaults set in the project configuration file (
checkly.config.ts
).
/__checks__
folder, we can run this test or deploy it. Go ahead and save this check locally, and try replacing the URL provided with one from your own site, and then running the check with:
npx checkly deploy
to deploy this to Checkly. But what we really want is to create dozens or hundreds of URL monitors all at once. We definitely don’t want to create hundreds of individual files just to monitor every URL in our service (and we certainly don’t want to manage all those files long-term 😅). Next, let’s use this same file to create multiple monitors.
Monitor Multiple URLs
urlArrayMonitors.check.ts
in our /__checks__
directory by running the command npx checkly deploy -p
.
Monitoring URLs Stored in a Local File
In our previous check, we defined the URLs to monitor in an array at the top of the file:urls.json
Monitor URLs Based by Fetching a CSV
Let’s continue to increase the sophistication of our group of monitors. Right now our logical IDs are generated based on the URL. This leads to some names that aren’t very human-readable. Let’s have our check file look for a CSV file that has columns with all the data. Our CSV is formatted like this:url | logicalID | name |
---|---|---|
https://www.checklyhq.com/docs/ | docs-1 | url monitor docs-1 |
https://www.checklyhq.com/learn/playwright/codegen/ | codegen-1 | url monitor codegen-1 |
https://www.checklyhq.com/guides/using-pw-test-command/ | pw-test-1 | url monitor pw-test-1 |
https://developers.checklyhq.com/reference/postv1incidents | incidents-1 | url monitor incidents-1 |
sitemap.xml
for URLs to monitor. For the moment, though, let’s move on to managing the configuration of multiple checks.
Manage Configuration for Multiple Monitors with Groups
As you handle monitors for multiple sites and environments, inevitably you’ll want to manage the configuration for a number of monitors all at once. Currently, by creating many monitors from a single file we’re giving each one the same configuration, and any configuration not specified will take the default values incheckly.config.ts
in the project’s root directory. We can create specific groups to receive configuration by adding the monitor to a group with Checkly constructs. Groups offer a convenient interface to configure your monitors, setting their retry strategy, alert thresholds, and where the group’s alerts will be sent. Groups also show up as folders in your Checkly web UI; making it easier to see the status of every check in the group.

Conclusion: Scale Your Monitoring Effortlessly with Checkly
Monitoring hundreds or even thousands of pages doesn’t have to be a tedious, manual process. With Checkly’s Monitoring as Code approach, you can dynamically create, update, and manage URL monitors at scale—whether from a local JSON file, a CSV, or even a sitemap. Remember that this approach works for more than just URL monitors, you can extend the automatic creation of monitors to API checks and even browser checks.Key Takeaways:
- Bulk Monitoring Made Simple: Define multiple URL monitors in a single file using arrays, loops, or external data sources like CSVs.
- Centralized Configuration: Use Groups to standardize settings like frequency, retries, and alerting across multiple monitors.
- Dynamic Updates: Modify your monitoring setup without losing historical data by leveraging unique logical IDs.
Next Steps
- Explore Advanced Checks: Beyond URL monitoring, Checkly supports API checks with deeper validation and setup/teardown scripts, and browser checks for full user flow validation.
- Set Up Alerts: Configure alert channels to notify your team of issues via Slack, email, or PagerDuty.
- Automate Deployments: Integrate Checkly into your CI/CD pipeline to ensure monitoring updates with every code change.
- Checkly CLI Documentation
- Monitoring as Code Best Practices
- The Defense-in-Depth Approach To Application Monitoring