Tutorial: Setup Automated Monitoring
This tutorial walks through setting up automated monitoring for your site using projects, tests, build schedules, and webhook notifications.
In Lumar's GraphQL schema, Project and TestSuite both implement the BaseProject interface and are effectively the same entity. This tutorial uses project-centric language. Some mutations still use testSuiteId as a parameter name -- pass your project ID to these fields.
Overview
Lumar's monitoring workflow consists of:
- Projects -- containers that group tests, builds, and monitoring configuration.
- Tests -- individual assertions (e.g., "Broken pages must be below 10").
- Build Schedules -- cron-based schedules that automatically trigger builds.
- Webhooks -- notifications sent when builds complete.
Step 1: Find or create a project
Query existing monitor projects for your account:
query GetMonitorProjects($accountId: ObjectID!) {
getAccount(id: $accountId) {
monitorProjects(first: 10) {
nodes {
id
name
lastFinishedCrawl {
id
status
createdAt
}
}
totalCount
}
}
}
If you need to create a project, see the Protect documentation for the createTestSuite mutation.
Step 2: Add tests
Tests define the thresholds for your monitoring. You can add both report-level tests and health score tests.
For health score tests:
mutation CreateHealthScoreTest($input: CreateHealthScoreTestInput!) {
createHealthScoreTest(input: $input) {
healthScoreTest {
absoluteThreshold
automaticThresholdEnabled
reportCategoryCode
severity
thresholdPredicate
thresholdType
}
}
}
For report-level tests, see the Tests documentation.
Step 3: Check build schedules
Review existing build schedules:
query GetBuildSchedules($accountId: ObjectID!) {
getAccount(id: $accountId) {
buildSchedules(first: 5) {
nodes {
id
repetitionRate
nextRunAt
buildScheduleTestSuites(first: 5) {
nodes {
testSuite {
id
name
}
}
}
}
totalCount
}
}
}
Build schedules use cron expressions. Common examples:
| Schedule | Cron Expression |
|---|---|
| Every Monday at midnight | 0 0 * * 1 |
| Daily at 6am | 0 6 * * * |
| Every 6 hours | 0 */6 * * * |
| First of every month | 0 0 1 * * |
To create or manage build schedules, see the Build Schedules documentation.
Step 4: Trigger a build manually (optional)
You can trigger a build immediately without waiting for the schedule:
mutation CreateAndRunBuild($input: CreateAndRunBuildInput!) {
createAndRunBuild(input: $input) {
build {
id
status
createdAt
}
}
}
Step 5: Set up webhooks
Configure Slack notifications so your team is alerted when builds complete:
mutation CreateSlackWebhook($input: CreateSlackWebhookInput!) {
createAutomatorSlackWebhook(input: $input) {
slackWebhook {
id
url
alertTypes
createdAt
}
}
}
Or set up an API callback webhook:
mutation CreateWebhook($input: CreateWebhookInput!) {
createWebhook(input: $input) {
webhook {
id
url
alertTypes
webhookTemplateType
createdAt
}
}
}
Step 6: Review results
After a build completes, query the project's test results:
query GetTestResults($testSuiteId: ObjectID!) {
node(id: $testSuiteId) {
... on TestSuite {
id
name
builds(first: 1, orderBy: [{ field: createdAt, direction: DESC }]) {
nodes {
id
status
createdAt
testResults(first: 10) {
nodes {
id
passed
reportTemplate {
code
name
}
absoluteThreshold
reportTotalRows
severity
}
totalCount
}
}
}
}
}
}
Next steps
- Webhooks guide -- full webhook configuration reference.
- Health Scores guide -- deep dive into health score tests and thresholds.
- Monitor guide -- managing notifications and monitoring workflows.