Skip to main content

Tutorial: Setup Automated Monitoring

This tutorial walks through setting up automated monitoring for your site using projects, tests, build schedules, and webhook notifications.

note

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:

  1. Projects -- containers that group tests, builds, and monitoring configuration.
  2. Tests -- individual assertions (e.g., "Broken pages must be below 10").
  3. Build Schedules -- cron-based schedules that automatically trigger builds.
  4. 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
}
}
}

Try in explorer

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
}
}
}

Try in explorer

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
}
}
}

Try in explorer

Build schedules use cron expressions. Common examples:

ScheduleCron Expression
Every Monday at midnight0 0 * * 1
Daily at 6am0 6 * * *
Every 6 hours0 */6 * * *
First of every month0 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:

curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":undefined}' https://api.lumar.io/graphql

Try in explorer

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
}
}
}

Try in explorer

Or set up an API callback webhook:

mutation CreateWebhook($input: CreateWebhookInput!) {
createWebhook(input: $input) {
webhook {
id
url
alertTypes
webhookTemplateType
createdAt
}
}
}

Try in explorer

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
}
}
}
}
}
}

Try in explorer

Next steps