Skip to content

Monitors

Usage monitors

Set thresholds on Appwrite usage metrics and monitor your whole project or an individual resource from the Console or a server SDK.

9 min read

Raw

Usage monitors compare a metric with a threshold. In your project, open Observe > Monitors and click Create monitor. On Appwrite Cloud, choose Usage as the type. Under Condition, choose a Metric, what it Applies to, a comparator, and a threshold. Applies to only lists the scopes that metric supports.

You can also create a monitor from a usage chart by dragging a threshold onto it, or start from a function, site, bucket, or database.

Choose a metric and scope

Metric picker open on the Create monitor page, grouped into Requests, Bandwidth, and Compute, with Outbound bandwidth selected
Metric picker open on the Create monitor page, grouped into Requests, Bandwidth, and Compute, with Outbound bandwidth selected

Choose The whole project for a project-wide total, or a single resource when the metric supports it. Counters are summed over the period in Counted over. Gauges compare their latest reading.

MetricAPI nameApplies toCompares
Requestsnetwork.requestsProjectSum
Inbound bandwidthnetwork.inboundProjectSum
Outbound bandwidthnetwork.outboundProjectSum
Bandwidthnetwork.bandwidthProjectSum
ExecutionsexecutionsProject, function, or siteSum
Function executionsfunctions.executionsProjectSum
Site executionssites.executionsProjectSum
Execution GB-hoursexecutions.mbSecondsProject, function, or siteSum
GB-hourscompute.mbSecondsProjectSum
Function GB-hoursfunctions.mbSecondsProjectSum
Site GB-hourssites.mbSecondsProjectSum
Concurrent connectionsrealtime.connectionsProjectLatest
Realtime messages sentrealtime.messages.sentProjectSum
Realtime bandwidthrealtime.bandwidthProjectSum
Monthly active usersusers.mauProjectLatest
Sign-upsusersProjectRise over the period
OTP attemptsauth.method.phoneProjectSum
Database readsdatabases.operations.readsProject or databaseSum
Database writesdatabases.operations.writesProject or databaseSum
CollectionscollectionsProject or databaseLatest
DocumentsdocumentsProject or databaseLatest
Database storagedatabases.storageProject or databaseLatest
Storage usedstorageProject, database, bucket, function, or siteLatest
File storagefiles.storageProjectLatest
Messages sentmessages.sentProjectSum
SMS messages sentmessages.sms.sentProjectSum
Messages failedmessages.failedProjectSum
TopicstopicsProjectLatest
Webhook events sentwebhooks.events.sentProjectSum
Webhook events failedwebhooks.events.failedProjectSum
WebhookswebhooksProjectLatest
Screenshots generatedavatars.screenshotsGeneratedProjectSum
Renditions encodedrenditions.successProjectSum
Failed renditionsrenditions.failedProjectSum
Video encoding GB-hoursvideos.mbSecondsProjectSum
VideosvideosProjectLatest
Video storagevideos.storageProjectLatest

Bandwidth and Realtime bandwidth add inbound and outbound traffic together. GB-hours, Function GB-hours, and Site GB-hours add executions and builds together, as the compute charts on the Usage page do.

On Appwrite Cloud, dedicated databases add CPU, Memory, Disk usage, Connections, Queries per second, Read IOPS, and Write IOPS. Their API names are dedicatedDatabases.cpu, dedicatedDatabases.memory, dedicatedDatabases.storage, dedicatedDatabases.connections, dedicatedDatabases.qps, dedicatedDatabases.iopsRead, and dedicatedDatabases.iopsWrite, and each compares its latest reading. Appwrite Cloud also adds Image transformations (files.imagesTransformed), the number of images transformed in the last 30 days, for the project or a bucket. It compares its latest reading.

Deleting a database, bucket, function, or site also deletes the monitors that watch it.

Set the condition

Create monitor page with a usage condition of outbound bandwidth greater than 10 GB counted over 1 hour, and a chart of the last 24 hours showing it would not have fired
Create monitor page with a usage condition of outbound bandwidth greater than 10 GB counted over 1 hour, and a chart of the last 24 hours showing it would not have fired

Under Alert when the value is, choose greater than, greater than or equal, less than, or less than or equal, and enter the threshold. A usage monitor compares one metric with one threshold.

Counted over sets the period a counter is summed over, from 5 minutes to 30 days. An outbound bandwidth monitor counted over 1 hour compares the sum over the preceding hour at each check. Gauges such as storage used compare their latest reading, so the Console hides Counted over for them.

Appwrite reads usage about 2 minutes behind real time, so requests still being recorded count toward a later check. If a check has no usage reading, the monitor keeps its status and any open alert. Check the monitor's last reading in the Console before adjusting the threshold.

Create a monitor from a chart

Requests chart on the Usage page with a red threshold line dragged above the busiest hour, and a card that reads Alert above 1,300 requests per hour with Cancel and Create monitor buttons
Requests chart on the Usage page with a red threshold line dragged above the busiest hour, and a card that reads Alert above 1,300 requests per hour with Cancel and Create monitor buttons

The charts on your project's Usage page, and on a database's Monitor tab, can create a monitor for the metric they plot.

  1. Hover over a chart. A dashed red line and a + handle appear at its right edge.
  2. Click +, then drag the handle to the threshold you want. You can also move it with the arrow keys. The card next to the line reads the condition, such as Alert above 1,300 requests per hour.
  3. If the chart plots more than one metric, such as inbound and outbound bandwidth, pick the one to monitor in the card.
  4. Click Create monitor.

The create form opens with the metric, what it applies to, greater than, and your threshold filled in. For a counter, Counted over matches the chart's interval, so a line on an hourly chart creates a monitor counted over 1 hour. Review the rest of the form and click Create.

To start at a specific level, right-click the chart there and choose Create monitor above that value, or Add threshold here to place the line and keep dragging.

Monitors that already watch a chart's metric show their threshold as a red line on it, or a gray line while paused. Hover the dot at the end of a line to see the monitor's name and threshold, and click it to open the monitor. A counter's line shows only when the chart's interval matches the monitor's Counted over period. Charts hide thresholds while usage filters are applied, because a monitor can't apply those filters.

Start from a resource

Function page with the Monitor menu open, listing Execution spike, Compute usage, Deployment storage, Custom monitor, and View monitors
Function page with the Monitor menu open, listing Execution spike, Compute usage, Deployment storage, Custom monitor, and View monitors

Function and site pages have a Monitor menu with monitors for that resource:

OptionMonitors
Execution spikeExecutions in an hour
Compute usageExecution GB-hours in a day
Deployment storageStorage used by deployments and builds
UptimeThe site's domain, with an HTTP endpoint check. Sites only, once a domain serves the active deployment.
Custom monitorAny metric the function or site supports

Each option opens the create form scoped to the function or site, and the usage options suggest a threshold from its recent usage. View monitors shows how many monitors already watch it.

You can also right-click a function, site, bucket, or database in its list, or a resource in a usage breakdown such as executions by function, and choose Create monitor.

How often usage is checked

On Appwrite Cloud, usage monitors are checked every 15 minutes on the Free plan and every minute on paid plans. Free projects can have 3 usage monitors and Pro projects 25. See Pricing for other plans.

On self-hosted Appwrite, each usage monitor is checked every 60 seconds. Set the _APP_ALERTS_INTERVAL environment variable to change the interval in seconds. Usage monitors read the usage stats that the _APP_USAGE_STATS variable turns on. It's enabled by default. If you set it to disabled, Appwrite never checks your usage monitors.

Create with a server SDK

In your project, open Connect > API Keys and create an API key with the monitors.write scope. Then call createUsageMonitor. This monitor opens an alert when the project sends more than 1 GB of outbound bandwidth in an hour, and notifies owners and developers at Error severity.

const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>')
.setKey('<API_KEY>');
const monitors = new sdk.Monitors(client);
const monitor = await monitors.createUsageMonitor({
monitorId: 'outbound-bandwidth',
name: 'Outbound bandwidth spike',
rules: [sdk.Query.greaterThan('network.outbound', 1000000000)],
window: 3600, // optional
cooldown: 1800, // optional
notify: ['owner', 'developer'], // optional
severity: sdk.MonitorSeverity.Error // optional
});

Each monitor ID must be unique in the project, and up to 36 characters long. Pass ID.unique() to have Appwrite generate one.

ParameterPurpose
rulesOne greaterThan, greaterThanEqual, lessThan, or lessThanEqual query on a metric's API name. To watch one resource instead of the whole project, add equal queries on resourceType and resourceId. resourceType takes database, bucket, function, site, or dedicatedDatabase. Thresholds use the metric's API unit: bytes for bandwidth and storage, MB-seconds for GB-hours, a percentage for dedicated database CPU and memory, and a count otherwise.
windowSeconds a counter is summed over, from 60 to 2,592,000. Defaults to 3,600. Gauges ignore it.
cooldownMinimum seconds between notifications for two alerts from this monitor, from 300 to 2,592,000. Defaults to 3,600.
enabledSet to false to create the monitor paused. Defaults to true.
notifyOrganization roles to notify, such as owner or developer. On Appwrite Cloud, editor, analyst, and billing also work. Defaults to ["owner"]. Pass an empty list to rely on project events alone.
severityinfo, warning, error, or critical. Defaults to warning.
escalationIdAn organization escalation to notify instead of notify. Pass an empty string on update to go back to notify.

To read monitors back, call list with queries or get with a monitor ID. Both need the monitors.read scope. updateUsageMonitor changes only the parameters you pass, including enabled to pause or resume a monitor, and delete removes one. Both need monitors.write. Deleting a monitor resolves its open alert and keeps its alert history.

Budget alerts

Billing alerts on the organization Billing page with alerts at 90%, 75%, and 50% of the budget cap, sent to the Owner and Billing roles
Billing alerts on the organization Billing page with alerts at 90%, 75%, and 50% of the budget cap, sent to the Owner and Billing roles

Usage monitors watch a single project. To be warned about your organization's spending on Appwrite Cloud, open the organization's Billing page, turn on Budget cap, and add percentages of the cap under Billing alerts. When this billing cycle's additional usage passes one of them, and again when it reaches the cap, Appwrite notifies the roles you choose there, owners and billing members by default. Budget alerts belong to the organization, so they don't appear on a project's Monitors page. Learn more in Budget cap.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.