Skip to content

Monitors

Endpoint checks

Check HTTP, DNS, TCP, and SMTP endpoints on a schedule with Appwrite Cloud synthetic checks, and set the rules that open an alert.

6 min read

Raw

Endpoint checks, called synthetic checks in the Console, are available on paid Appwrite Cloud plans. Appwrite connects to your target on a schedule and opens an alert when the check fails.

Synthetic checks count toward one allowance for the whole organization, across all of its projects. Pro includes 10 checks, and each additional check costs $2 per month. The shortest check interval is 1 minute on Pro and 30 seconds on Enterprise. Synthetic checks aren't available on the Free plan, and an organization can't move to Free while it has any. See Pricing for details.

Create an endpoint check

Checks, Notify, and Severity on the Create monitor page for an endpoint check that runs every minute, fails after 10 seconds, and notifies owners
Checks, Notify, and Severity on the Create monitor page for an endpoint check that runs every minute, fails after 10 seconds, and notifies owners

  1. In your project, open Observe > Monitors, then click Create monitor.
  2. Choose HTTP, DNS, TCP, or SMTP as the type. Under Target, enter what to check and what a healthy response looks like.
  3. Under Checks, set how often to check and how long a check can take before it times out. Checks run from every 30 seconds to every hour, and your plan sets the shortest interval. The timeout ranges from 5 seconds to 1 minute and can't be longer than the interval.
  4. Choose recipients under Notify and pick a Severity. To set a name or change the cooldown, expand Name, cooldown.
  5. Click Create.

The Monitors list shows the latest result, latency, and time of each check. Open a monitor to see its status, target, latest result, and when it last fired.

Some failures always open an alert, whatever you expect from the target: a timeout, a domain that doesn't resolve, a refused or failed connection, a failed TLS handshake, or a target in a private network, which Appwrite doesn't connect to.

HTTP

Create monitor page with an HTTP check of api.example.com/health that expects status 200 and warns 14 days before the certificate expires
Create monitor page with an HTTP check of api.example.com/health that expects status 200 and warns 14 days before the certificate expires

Enter an http:// or https:// URL and choose a request method. You can add headers and, for methods that send one, a request body. Appwrite follows redirects and ignores the response body.

Enter a comma-separated list of Expected status codes, or leave it empty to accept any 2xx response.

For an HTTPS URL, Certificate expiry warning sets how many days before the certificate expires the check fails. It defaults to 14 days. So that certificates renewed on a normal schedule don't fire, the warning also waits until less than a quarter of the certificate's lifetime is left. Set it to 0 to turn the warning off. An invalid certificate still fails the check.

DNS

DNS check of shop.example.com for an A record that expects 203.0.113.24, resolved through 1.1.1.1
DNS check of shop.example.com for an A record that expects 203.0.113.24, resolved through 1.1.1.1

Enter the domain and select an A, AAAA, CNAME, MX, TXT, or NS record. Enter an Expected answer to fail when the first record doesn't match it, or leave it empty to fail only when the domain returns no records. Appwrite compares answers in lowercase, without the trailing dot.

Resolver takes an IP address with an optional port, such as 1.1.1.1 or [2606:4700:4700::1111]:53. Leave it empty to use Appwrite's resolver.

TCP

TCP check that connects to db.example.com on port 5432
TCP check that connects to db.example.com on port 5432

Enter a host and port. The check passes when Appwrite can open a TCP connection to that port within the timeout, and it closes the connection straight away. Use an HTTP or SMTP check when you also need to verify how the service responds.

SMTP

SMTP check of mail.example.com on port 587 with TLS chosen from the port
SMTP check of mail.example.com on port 587 with TLS chosen from the port

Enter the mail server's host and port. Appwrite reads the server's greeting, sends EHLO, and secures the connection as the TLS setting asks. It never signs in or sends mail.

TLS settingBehavior
From the portImplicit TLS on port 465, STARTTLS on port 587, and a plain connection on other ports.
NoneConnect without TLS.
Upgrade with STARTTLSUpgrade the session with STARTTLS. The check fails if the server doesn't offer it.
Implicit TLSStart TLS as soon as the connection opens.

Create with a server SDK

Each type has its own method: createHttpMonitor, createDnsMonitor, createTcpMonitor, and createSmtpMonitor. To call them, create an API key with the monitors.write scope under Connect > API Keys in your project. This example checks https://api.example.com/health every minute and opens a Critical alert when the response isn't a 2xx status or takes longer than 2 seconds.

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.createHttpMonitor({
monitorId: 'api-health',
name: 'API health',
url: 'https://api.example.com/health',
rules: [
sdk.Query.or([
sdk.Query.notBetween('statusCode', 200, 299),
sdk.Query.greaterThan('latency', 2000)
])
], // optional
interval: 60, // optional
timeout: 10, // optional
severity: sdk.MonitorSeverity.Critical // optional
});

Each type takes its own target parameters:

MethodTarget parameters
createHttpMonitorurl, plus optional method, headers, and body. method defaults to GET and also takes HEAD, POST, PUT, PATCH, DELETE, or OPTIONS. body takes up to 16,384 characters.
createDnsMonitordomain, plus optional record and resolver. record defaults to A and also takes AAAA, CNAME, MX, TXT, or NS.
createTcpMonitorhost and port
createSmtpMonitorhost and port, plus optional tlsMode. It defaults to auto, which chooses from the port, and also takes none, starttls, or implicit.

All four also take these parameters:

ParameterPurpose
rulesQueries that describe a failing check. See Rules.
intervalSeconds between checks. Defaults to 60, or to your plan's shortest interval when that's longer.
timeoutSeconds a check can take, from 1 to 60 and no longer than interval. Defaults to 10.
cooldown, enabled, notify, severity, escalationIdThe same as for usage monitors.

Each type has a matching update method, such as updateHttpMonitor, which only changes the parameters you pass.

Rules

Rules describe a failing check: the monitor opens an alert when they match. Every top-level rule must match. Wrap rules in Query.or() to fire when any of them matches, and use Query.and() to group rules inside it. Rules take the equal, notEqual, lessThan, lessThanEqual, greaterThan, greaterThanEqual, between, and notBetween queries.

TypeAttributesFails by default on
HTTPstatusCode, latency in milliseconds, certificateDays left, and certificateLifetime, the percentage of the certificate's lifetime leftA status outside 200 to 299, or a certificate with fewer than 14 days and less than 25% of its lifetime left
DNSanswer, the first record in lowercase without the trailing dot, which only takes equal and notEqual; answers, the number of records; and latencyNo records
TCPlatencyConnection failures only
SMTPcode, the server's reply code, plus latency, certificateDays, and certificateLifetimeConnection failures only

Your rules replace the defaults, so add certificate rules to an HTTP check if you still want it to warn before the certificate expires. Passing rules to an update method replaces all of the monitor's rules. The failures listed under Create an endpoint check open an alert whatever the rules say.

The Console saves Expected status codes, Certificate expiry warning, and Expected answer as rules. It keeps rules set through the API that those fields can't show until you change one of the fields.

Was this page helpful?

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