Loading...
Loading...
Create and manage monitoring checks using the Checkly CLI. Use when working with API checks, browser checks, URL monitors, Playwright checks, heartbeat monitors, alert channels, dashboards, or status pages.
npx skill4agent add checkly/checkly-cli monitoringApiCheckBrowserCheckPlaywrightCheckcheckly/constructsnpm create checkly@latestcheckly.config.ts*.check.ts|js*.spec.ts|jssrc/__checks__package.json-- src checkly.config.tsimport { defineConfig } from 'checkly'
import { Frequency } from 'checkly/constructs'
export default defineConfig({
projectName: "Production Monitoring Suite",
logicalId: "prod-monitoring-2025",
repoUrl: "https://github.com/acme/monitoring",
checks: {
activated: true,
muted: false,
runtimeId: "2025.04",
frequency: Frequency.EVERY_10M,
locations: ["us-east-1", "eu-west-1", "ap-southeast-1"],
tags: ["production", "critical"],
checkMatch: "**/__checks__/*.check.ts",
ignoreDirectoriesMatch: ["node_modules/**", "dist/**"],
playwrightConfig: {
use: {
baseURL: "https://app.example.com",
},
},
browserChecks: {
frequency: Frequency.EVERY_30M,
testMatch: "**/__tests__/*.spec.ts",
},
},
cli: {
runLocation: "eu-west-1",
privateRunLocation: "private-dc1",
retries: 2,
},
})ApiCheckcheckly/constructsassertionsAssertionBuilder{{MY_ENV_VAR}}{{MY_SECRET}}setupScript.tsteardownScript.tsimport { AlertEscalationBuilder, ApiCheck, Frequency, RetryStrategyBuilder } from 'checkly/constructs'
new ApiCheck('example-api-check', {
name: 'Example API Check',
request: {
url: 'https://api.example.com/v1/products',
method: 'GET',
ipFamily: 'IPv4',
},
setupScript: {
entrypoint: './setup-script.ts',
},
tearDownScript: {
entrypoint: './teardown-script.ts',
},
degradedResponseTime: 5000,
maxResponseTime: 20000,
activated: true,
muted: false,
shouldFail: false,
locations: [
'eu-central-1',
'eu-west-2',
],
frequency: Frequency.EVERY_5M,
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
amount: 0,
interval: 5,
}, {
enabled: false,
percentage: 10,
}),
retryStrategy: RetryStrategyBuilder.linearStrategy({
baseBackoffSeconds: 60,
maxRetries: 2,
maxDurationSeconds: 600,
sameRegion: true,
}),
runParallel: true,
})process.envrequest.headers['key'] = AUTH_TOKEN_VALUEBrowserCheckcheckly/constructs.spec.tsBrowserCheckcode.entrypointimport { AlertEscalationBuilder, BrowserCheck, Frequency, RetryStrategyBuilder } from 'checkly/constructs'
new BrowserCheck('example-browser-check', {
name: 'Example Browser Check',
code: {
entrypoint: './example-browser-check.spec.ts',
},
activated: false,
muted: false,
shouldFail: false,
locations: [
'eu-central-1',
'eu-west-2',
],
frequency: Frequency.EVERY_10M,
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
amount: 0,
interval: 5,
}, {
enabled: false,
percentage: 10,
}),
retryStrategy: RetryStrategyBuilder.linearStrategy({
baseBackoffSeconds: 60,
maxRetries: 2,
maxDurationSeconds: 600,
sameRegion: true,
}),
runParallel: true,
})PlaywrightCheckcheckly/constructspwProjectsimport { PlaywrightCheck } from "checkly/constructs"
const playwrightChecks = new PlaywrightCheck("multi-browser-check", {
name: "Multi-browser check suite",
playwrightConfigPath: "./playwright.config.ts",
// Playwright Check Suites support all browsers
// defined in your `playwright.config`
pwProjects: ["chromium", "firefox", "webkit"],
});MultiStepCheckcheckly/constructs.spec.tsMultiStepCheckcode.entrypointimport { AlertEscalationBuilder, Frequency, MultiStepCheck, RetryStrategyBuilder } from 'checkly/constructs'
new MultiStepCheck('example-multi-step-check', {
name: 'Example Multistep Check',
code: {
entrypoint: './example-multistep-check.spec.ts',
},
activated: true,
muted: false,
shouldFail: false,
locations: [
'eu-central-1',
'eu-west-2',
],
frequency: Frequency.EVERY_1H,
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
amount: 0,
interval: 5,
}, {
enabled: false,
percentage: 10,
}),
retryStrategy: RetryStrategyBuilder.noRetries(),
runParallel: true,
})TcpMonitorcheckly/constructsassertionsTcpAssertionBuilderimport { AlertEscalationBuilder, Frequency, RetryStrategyBuilder, TcpAssertionBuilder, TcpMonitor } from 'checkly/constructs'
new TcpMonitor('example-tcp-monitor', {
name: 'Example TCP Monitor',
request: {
hostname: 'tcp.example.com',
port: 4242,
ipFamily: 'IPv4',
assertions: [
TcpAssertionBuilder.responseTime().lessThan(200),
TcpAssertionBuilder.responseData().isEmpty(),
],
},
degradedResponseTime: 5000,
maxResponseTime: 5000,
activated: true,
muted: false,
shouldFail: false,
locations: [
'eu-central-1',
'eu-west-2',
],
frequency: Frequency.EVERY_1H,
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
amount: 0,
interval: 5,
}, {
enabled: false,
percentage: 10,
}),
retryStrategy: RetryStrategyBuilder.linearStrategy({
baseBackoffSeconds: 60,
maxRetries: 2,
maxDurationSeconds: 600,
sameRegion: true,
}),
runParallel: true,
})UrlMonitorcheckly/constructsassertionsUrlAssertionBuilderimport { AlertEscalationBuilder, Frequency, RetryStrategyBuilder, UrlAssertionBuilder, UrlMonitor } from 'checkly/constructs'
new UrlMonitor('example-url-monitor', {
name: 'Example URL Monitor',
request: {
url: 'https://example.com',
ipFamily: 'IPv4',
assertions: [
UrlAssertionBuilder.statusCode().equals(200),
],
},
degradedResponseTime: 5000,
maxResponseTime: 20000,
activated: true,
muted: false,
shouldFail: false,
locations: [
'eu-central-1',
'eu-west-2',
],
frequency: Frequency.EVERY_5M,
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
amount: 0,
interval: 5,
}, {
enabled: false,
percentage: 10,
}),
retryStrategy: RetryStrategyBuilder.linearStrategy({
baseBackoffSeconds: 60,
maxRetries: 2,
maxDurationSeconds: 600,
sameRegion: true,
}),
runParallel: true,
})DnsMonitorcheckly/constructsassertionsDnsAssertionBuilderimport { AlertEscalationBuilder, DnsAssertionBuilder, DnsMonitor, Frequency, RetryStrategyBuilder } from 'checkly/constructs'
new DnsMonitor('example-dns-monitor', {
name: 'Example DNS Monitor',
request: {
recordType: 'AAAA',
query: 'welcome.checklyhq.com',
assertions: [
DnsAssertionBuilder.responseCode().equals('NOERROR'),
],
},
degradedResponseTime: 500,
maxResponseTime: 1000,
activated: true,
muted: false,
shouldFail: false,
locations: [
'eu-central-1',
'eu-north-1',
],
frequency: Frequency.EVERY_10M,
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
amount: 0,
interval: 5,
}, {
enabled: false,
percentage: 10,
}),
retryStrategy: RetryStrategyBuilder.noRetries(),
runParallel: false,
})HeartbeatMonitorcheckly/constructsimport { AlertEscalationBuilder, Frequency, HeartbeatMonitor, RetryStrategyBuilder } from 'checkly/constructs'
new HeartbeatMonitor('example-heartbeat-monitor', {
name: 'Example Heartbeat Monitor',
period: 1,
periodUnit: 'hours',
grace: 30,
graceUnit: 'minutes',
activated: true,
muted: false,
shouldFail: false,
frequency: Frequency.EVERY_10S,
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
amount: 0,
interval: 5,
}, {
enabled: false,
percentage: 10,
}),
retryStrategy: RetryStrategyBuilder.linearStrategy({
baseBackoffSeconds: 60,
maxRetries: 2,
maxDurationSeconds: 600,
sameRegion: true,
}),
runParallel: true,
})CheckGroupV2checkly/constructsgroupimport { CheckGroupV2 } from 'checkly/constructs'
export const exampleGroup = new CheckGroupV2('example-group', {
name: 'Example Group',
})alertChannelsimport { EmailAlertChannel } from 'checkly/constructs'
export const testEmailAlert = new EmailAlertChannel('example-email-alert-channel', {
address: 'test@example.com',
sslExpiry: true,
})import { PhoneCallAlertChannel } from 'checkly/constructs'
export const testUserPhoneCallAlert = new PhoneCallAlertChannel('example-call-alert-channel', {
name: 'Test User',
phoneNumber: '+311234567890',
})import { SlackAlertChannel } from 'checkly/constructs'
export const generalSlackAlert = new SlackAlertChannel('example-slack-alert-channel', {
url: 'https://hooks.slack.com/services/TK123456789123/12345/123456789',
channel: '#general',
})StatusPagecheckly/constructsimport { StatusPage } from 'checkly/constructs'
import { exampleService } from './services/example-service.check'
new StatusPage('example-status-page', {
name: 'Example Status Page',
url: 'example-status-page',
cards: [
{
name: 'Example service',
services: [
exampleService,
],
},
],
customDomain: 'status.example.com',
defaultTheme: 'AUTO',
})StatusPageServicecheckly/constructsimport { StatusPageService } from 'checkly/constructs'
export const exampleService = new StatusPageService('example-status-page-service', {
name: 'Example Service',
})Dashboardcheckly/constructsimport { Dashboard } from 'checkly/constructs'
new Dashboard('example-dashboard', {
tags: [
'app:webshop',
],
customUrl: 'example-dashboard',
customDomain: 'dash.example.com',
header: 'Example Dashboard',
description: 'Example dashboard',
width: 'FULL',
refreshRate: 60,
paginate: true,
paginationRate: 60,
checksPerPage: 15,
useTagsAndOperator: false,
hideTags: false,
enableIncidents: false,
expandChecks: false,
showHeader: true,
isPrivate: false,
showP95: true,
showP99: true,
})MaintenanceWindowcheckly/constructstagsimport { MaintenanceWindow } from 'checkly/constructs'
new MaintenanceWindow('example-maintenance-window', {
name: 'Example Maintenance Window',
tags: [
'app:webshop',
],
startsAt: new Date('2025-07-01T09:00:00.000Z'),
endsAt: new Date('2025-07-01T10:00:00.000Z'),
repeatInterval: 1,
repeatUnit: 'WEEK',
repeatEndsAt: new Date('2025-08-01T00:00:00.000Z'),
})PrivateLocationcheckly/constructsimport { PrivateLocation } from 'checkly/constructs'
export const examplePrivateLocation = new PrivateLocation('example-private-location', {
name: 'Example Private Location',
slugName: 'example-private-location',
icon: 'location',
})npx checkly test-e--record--verbose