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
- Variables
- Response
- cURL
query GetMonitorProjects($accountId: ObjectID!) {
getAccount(id: $accountId) {
monitorProjects(first: 10) {
nodes {
id
name
lastFinishedCrawl {
id
status
createdAt
}
}
totalCount
}
}
}
{
"accountId": "TjAwN0FjY291bnQ3MTU"
}
{
"data": {
"getAccount": {
"monitorProjects": {
"nodes": [
{
"id": "TjAxMVRlc3RTdWl0ZTEyMw",
"name": "Production SEO Suite",
"lastFinishedCrawl": {
"id": "TjAwNUNyYXdsMTc2NjI0MQ",
"status": "Finished",
"createdAt": "2025-01-15T10:00:00.000Z"
}
}
],
"totalCount": 1
}
}
}
}
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":"query GetMonitorProjects($accountId: ObjectID!) { getAccount(id: $accountId) { monitorProjects(first: 10) { nodes { id name lastFinishedCrawl { id status createdAt } } totalCount } } }","variables":{"accountId":"TjAwN0FjY291bnQ3MTU"}}' https://api.lumar.io/graphql
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
- Variables
- Response
- cURL
mutation CreateHealthScoreTest($input: CreateHealthScoreTestInput!) {
createHealthScoreTest(input: $input) {
healthScoreTest {
absoluteThreshold
automaticThresholdEnabled
reportCategoryCode
severity
thresholdPredicate
thresholdType
}
}
}
{
"input": {
"testSuiteId": "TjAxMVRlc3RTdWl0ZTEyMw",
"reportCategoryCode": "seo",
"absoluteThreshold": 0.8,
"thresholdType": "Relative",
"relativeThreshold": 10,
"severity": "Fail",
"automaticThresholdEnabled": false
}
}
{
"data": {
"createHealthScoreTest": {
"healthScoreTest": {
"absoluteThreshold": 0.8,
"automaticThresholdEnabled": false,
"reportCategoryCode": "seo",
"severity": "Fail",
"thresholdPredicate": "GreaterThanOrEqual",
"thresholdType": "Relative"
}
}
}
}
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":"mutation CreateHealthScoreTest($input: CreateHealthScoreTestInput!) { createHealthScoreTest(input: $input) { healthScoreTest { absoluteThreshold automaticThresholdEnabled reportCategoryCode severity thresholdPredicate thresholdType } } }","variables":{"input":{"testSuiteId":"TjAxMVRlc3RTdWl0ZTEyMw","reportCategoryCode":"seo","absoluteThreshold":0.8,"thresholdType":"Relative","relativeThreshold":10,"severity":"Fail","automaticThresholdEnabled":false}}}' https://api.lumar.io/graphql
For report-level tests, see the Tests documentation.
Step 3: Check build schedules
Review existing build schedules:
- Query
- Variables
- Response
- cURL
query GetBuildSchedules($accountId: ObjectID!) {
getAccount(id: $accountId) {
buildSchedules(first: 5) {
nodes {
id
repetitionRate
nextRunAt
buildScheduleTestSuites(first: 5) {
nodes {
testSuite {
id
name
}
}
}
}
totalCount
}
}
}
{
"accountId": "TjAwN0FjY291bnQ3MTU"
}
{
"data": {
"getAccount": {
"buildSchedules": {
"nodes": [
{
"id": "TjAzN0J1aWxkU2NoZWR1bGUx",
"repetitionRate": "Weekly",
"nextRunAt": "2025-01-20T00:00:00.000Z",
"buildScheduleTestSuites": {
"nodes": [
{
"testSuite": {
"id": "TjAxMVRlc3RTdWl0ZTEyMw",
"name": "Production SEO Suite"
}
}
]
}
}
],
"totalCount": 1
}
}
}
}
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":"query GetBuildSchedules($accountId: ObjectID!) { getAccount(id: $accountId) { buildSchedules(first: 5) { nodes { id repetitionRate nextRunAt buildScheduleTestSuites(first: 5) { nodes { testSuite { id name } } } } totalCount } } }","variables":{"accountId":"TjAwN0FjY291bnQ3MTU"}}' https://api.lumar.io/graphql
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:
- cURL
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
Step 5: Set up webhooks
Configure Slack notifications so your team is alerted when builds complete:
- Mutation
- Variables
- Response
- cURL
mutation CreateSlackWebhook($input: CreateSlackWebhookInput!) {
createAutomatorSlackWebhook(input: $input) {
slackWebhook {
id
url
alertTypes
createdAt
}
}
}
{
"input": {
"testSuiteId": "TjAxMVRlc3RTdWl0ZTEyMw",
"url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
"alertTypes": ["Pass", "Warning", "Fail"]
}
}
{
"data": {
"createAutomatorSlackWebhook": {
"slackWebhook": {
"id": "TjAzN1NsYWNrV2ViaG9vazE",
"url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
"alertTypes": ["Pass", "Warning", "Fail"],
"createdAt": "2025-01-15T10:00:00.000Z"
}
}
}
}
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":"mutation CreateSlackWebhook($input: CreateSlackWebhookInput!) { createAutomatorSlackWebhook(input: $input) { slackWebhook { id url alertTypes createdAt } } }","variables":{"input":{"testSuiteId":"TjAxMVRlc3RTdWl0ZTEyMw","url":"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX","alertTypes":["Pass","Warning","Fail"]}}}' https://api.lumar.io/graphql
Or set up an API callback webhook:
- Mutation
- Variables
- Response
- cURL
mutation CreateWebhook($input: CreateWebhookInput!) {
createWebhook(input: $input) {
webhook {
id
url
alertTypes
webhookTemplateType
createdAt
}
}
}
{
"input": {
"testSuiteId": "TjAxMVRlc3RTdWl0ZTEyMw",
"url": "https://example.com/api/lumar-webhook",
"alertTypes": ["Pass", "Warning", "Fail"],
"webhookTemplateType": "MSTeams"
}
}
{
"data": {
"createWebhook": {
"webhook": {
"id": "TjAzN1dlYmhvb2sx",
"url": "https://example.com/api/lumar-webhook",
"alertTypes": ["Pass", "Warning", "Fail"],
"webhookTemplateType": "MSTeams",
"createdAt": "2025-01-15T10:00:00.000Z"
}
}
}
}
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":"mutation CreateWebhook($input: CreateWebhookInput!) { createWebhook(input: $input) { webhook { id url alertTypes webhookTemplateType createdAt } } }","variables":{"input":{"testSuiteId":"TjAxMVRlc3RTdWl0ZTEyMw","url":"https://example.com/api/lumar-webhook","alertTypes":["Pass","Warning","Fail"],"webhookTemplateType":"MSTeams"}}}' https://api.lumar.io/graphql
Step 6: Review results
After a build completes, query the project's test results:
- Query
- Variables
- Response
- cURL
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
}
}
}
}
}
}
{
"testSuiteId": "TjAxMVRlc3RTdWl0ZTEyMw"
}
{
"data": {
"node": {
"id": "TjAxMVRlc3RTdWl0ZTEyMw",
"name": "Production SEO Suite",
"builds": {
"nodes": [
{
"id": "TjAxMkJ1aWxkNDU2",
"status": "Finished",
"createdAt": "2025-01-15T10:00:00.000Z",
"testResults": {
"nodes": [
{
"id": "TjAxM1Rlc3RSZXN1bHQ3ODk",
"passed": true,
"reportTemplate": {
"code": "broken_pages",
"name": "Broken Pages"
},
"absoluteThreshold": 5.0,
"reportTotalRows": 2.0,
"severity": "Fail"
}
],
"totalCount": 1
}
}
]
}
}
}
}
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":"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 } } } } } }","variables":{"testSuiteId":"TjAxMVRlc3RTdWl0ZTEyMw"}}' https://api.lumar.io/graphql
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.