Monitor Edge Server - Preview
You can view metrics and logs for your Edge Server instances to get a general health status, or information about usage, performance, and errors.
You can monitor an instance:
In the Atlas UI
In a UI on the local hardware
Through Admin API calls
You can also forward logs to a MongoDB collection or an external service.
This page contains details about how to view metrics and logs for your Edge Server instances, and what information is available.
Before You Begin
You need the following to manage Edge Servers in the Atlas UI:
A MongoDB Atlas account with Project Owner permissions. To learn how to sign up for a free account, see Get Started with Atlas.
The local UI is enabled by default, and only requires a running Edge Server instance.
On an untrusted host, you can disable the local UI by running the
following edgectl
command:
edgectl config --disable-local-ui=true
You need the following to manage Edge Servers with the Admin API:
A MongoDB Atlas account with Project Owner permissions. To learn how to sign up for a free account, see Get Started with Atlas.
A MongoDB Atlas Admin API public/private key pair. The API key must have Project Owner permissions to work with App Services Admin API.
Your App's internal ObjectId hex string and the Project ID of the Atlas Project that contains your App. To learn how to find these, see Get App Metadata.
Get Edge Server Instance Status
You can get details about the status of Edge Server instance in a few ways:
View the Edge Server instance details in the Atlas UI
View the status details in the local UI
Use
edgectl
to check the statusMake a request to the relevant Admin API endpoint
The available details vary depending on how you access them.
The Edge Server dashboard lists a brief summary for each Edge Server instance, including the date and time of the last connection, and a snapshot of its status. You can optionally view details or logs for each instance.
To view the Edge Server dashboard, choose Edge Server in the left navigation sidebar.
To view the details for a specific Edge Server instance, click View Details for that Edge Server instance. Alternately, click App Logs to browse logs associated with the instance.
The information available when viewing an Edge Server instance varies depending on the instance state. For details, refer to Edge Server Instance Details.
To access the local UI, open a web browser and go to localhost
on the http-port
. You can access the local UI on the default port
at: http://localhost:80
You can change the port by providing an alternative port as an Int
with the following edgectl
flag:
edgectl config --http-port=<YOUR-PORT-INT>
When the Edge Server instance is running, you can see the status of the instance with:
edgectl status
This gives you information about the state of the Edge Server containers, and a detailed status for the Sync server with a breakdown of important information. It may look similar to:
{ "mongoContainerStatus": { "message": "running" }, "mongoDBStatus": { "message": "ready" }, "syncServerContainerStatus": { "message": "running" }, "syncServerStatus": { "message": "ACTIVE" }, "syncServerDetailedStatus": { "version": "v0.22.3", "status": "ACTIVE", "cloud_connected": true, "num_local_clients": 0, "query": { "Item": "truepredicate" } } }
The syncServerDetailedStatus
contains information about the state of the
Edge Server instance. This includes details about its connection to
Atlas, and the clients connected to it, as follows:
Field name | Type | Value |
---|---|---|
version | String | The current version of the Edge Server code that the instance is
running. If the Edge Server instance falls more than one major version
behind the latest available version, it is unable to connect to Atlas
and must be wiped and updated. For more information, refer to
Upgrade the Edge Server Version. |
status | String | The current status of the Edge Server instance. Possible values include:
|
cloud_connected | Boolean | If true , the Edge Server instance is currently connected to Atlas.
If false , the Edge Server instance is not connected to Atlas. When
the instance is not connected to Atlas, it can still receive local
connections and sync data with local clients. When it reconnects with
Atlas, it attempts to sync data that changed while it was not connected. |
num_local_clients | Int | The number of clients that are currently connected to the Edge Server
instance through Atlas Device SDK. This does not include connections
through the Wire Protocol. |
query | Object | The Edge Server instance Sync query, presented as a JSON object. For
more information, refer to Specify the Edge Server's Query. |
Authenticate a MongoDB Atlas User
Call the admin user authentication endpoint with your MongoDB Atlas API key pair:
curl -X POST \ https://services.cloud.mongodb.com/api/admin/v3.0/auth/providers/mongodb-cloud/login \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "username": "<Public API Key>", "apiKey": "<Private API Key>" }'
If authentication succeeds, the response body contains a JSON object
with an access_token
value:
{ "access_token": "<access_token>", "refresh_token": "<refresh_token>", "user_id": "<user_id>", "device_id": "<device_id>" }
The access_token
grants access to the App Services Admin API. You
must include it as a Bearer token in the Authorization
header for
all Admin API requests.
Get the List of Edge Server Instances
Call the Admin API List Edge Servers endpoint to get a list of all the Edge Servers instances.
Your request must include an Authorization
header with your
Admin API access token as a
Bearer token.
curl -X GET \ https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/edge \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <AccessToken>'
A successful request returns a 200
code, and an
edge_servers
key whose values is an array of objects containing
summary details for each Edge Server instance associated with the
appId
.
{ "edge_servers": [ { "id": "6622b8f5118368b943d228a9", "created": "2024-04-19T08:51:00Z", "name": "Edge-Store-42", "user_id": "6622b8f5118368b943d2288a", "status": "active", "hostname": "ec2-13-58-70-88.us-east-2.compute.amazonaws.com", "last_connection": "2024-04-19T09:51:00Z" } ] }
For more detailed information, find the id
of the instance
whose details you want to view.
Call the Edge Server Info Endpoint
Call the Admin API Get Edge Server information endpoint to get detailed information about an Edge Server instance.
Your request must include an Authorization
header with your
Admin API access token as a
Bearer token.
curl -X GET \ https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/edge/{edgeServerId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <AccessToken>'
A successful request returns a 200
code, as well as a JSON
object with detailed information about the Edge Server instance:
{ "id": "6622b8f5118368b943d228a9", "created": "2024-04-19T08:51:00Z", "name": "Edge-Store-42", "user_id": "6622b8f5118368b943d2288a", "status": "active", "hostname": "ec2-13-58-70-88.us-east-2.compute.amazonaws.com", "last_connection": "2024-04-19T09:51:00Z", "query": { "Item": "(store_id == \"641cb3d99e425c794ef69315\")" }, "package_version": "v0.21.2", "latest_package_version": "v0.22.2", "metrics": [ { "key": "edge_host_memory_percent", "name": "Memory Usage", "category": "host", "detail": "Percentage of memory used by the edge container", "value": 15, "unit": "%" }, ...additional Edge Server metrics... ] }
For more information about this response body, refer to the API specification.
Edge Server Logs
Edge Server uses the following log types:
Authentication Logs: When an Edge Server instance attempts to authenticate with Atlas, or clients attempt to authenticate with an Edge Server instance, this generates an authentication log.
Device Sync Logs: When an Edge Server instance syncs with Atlas, or an Atlas Device SDK client syncs with Edge Server, this generates a Device Sync log.
Access Edge Server Logs
You can access your logs with the Admin API's
Admin API Retrieve App Services logs
endpoint. Filter for the user_id
matching the Edge Server instance
user_id
. Or you can view logs when viewing Edge Server Instance Details in
the Atlas UI.
Forward Edge Server Logs
You can configure log forwarders to store logs in a MongoDB collection or send them to an external service. For more information, refer to Forward Logs to a Service.
Edge Server Metrics
An Edge Server instance tracks a variety of metrics about:
The host hardware
Requests
Wire Protocol connections, and their activity
Sync
You can access your metrics data with the Admin API's Admin API Get Edge Server information endpoint. Or you can view a subset of these metrics when viewing Edge Server Instance Details in the Atlas UI.
The exact metrics returned may be subject to change.
Metric key | Name | Category | Unit | Description |
---|---|---|---|---|
edge_host_memory_percent | Memory Usage | Host | Percent (%) | Percentage of memory used by the Edge Server containers. |
edge_host_cpu_percent | CPU Usage | Host | Percent (%) | Percentage of CPU used by the Edge Server containers. |
overall_request_success | Successful Requests | Overall | Int | The total number of successful requests. |
overall_request_fail | Failed Requests | Overall | Int | The total number of failed requests. |
wire_protocol_request_success | Successful Wire Protocol Requests | Wire Protocol | Int | The total number of successful Wire Protocol requests. |
wire_protocol_request_fail | Failed Wire Protocol Requests | Wire Protocol | Int | The total number of failed Wire Protocol requests. |
wire_protocol_egress_bytes | Wire Protocol Data Transfer | Wire Protocol | Bytes | The total number of bytes returned by Wire Protocol. |
edge_wire_protocol_connection_count | Wire Protocol Connection Count | Wire Protocol | Int | The total number of clients currently connected using the Wire Protocol.
These connections include MongoDB Drivers, MongoDB Shell, MongoDB Compass,
and other tools that use the Wire Protocol connection. |
sync_requests_success | Successful Sync Requests | Sync | Int | The total number of successful sync requests. |