The Foglight Agent Manager (FglAM) must run on an EC2 instance in the same VPC as the DocumentDB clusters to be monitored. For connecting a new DocumentDB cluster to a new or existing Foglight Agent Manager, see Connect Amazon EC2 automatically. Create an EC2 instance on which to install and run the new FglAM in step 1. Skip this step in the case of an existing Agent Manager. For connecting an existing DocumentDB cluster to a new or existing Foglight Agent Manager, see Connect Amazon EC2 manually. Create an EC2 instance on which to install and run the new FglAM in step 1. Skip this step in the case of an existing Agent Manager.
These instructions show the pre-configuration steps for configuring the Agent Manager when TLS is enabled on the DocumentDB cluster.
vmparameter.0 = "-Djavax.net.ssl.trustStore=/path/to/truststore";
vmparameter.1 = "-Djavax.net.ssl.trustStorePassword=changeit";
Escape any quotes with a backslash (’\’).
On an Agent Manager installed on Windows, use forward slashes in the file paths, like so:
vmparameter.0 = "-Djavax.net.ssl.trustStore=\"C:/path/to/truststore\"";
The Foglight for DocumentDB agent will be configured with a cluster/instance address, consisting of a host URL and a port. Further, the agent requires two credentials to monitor the DocumentDB environment: an IAM access key with specific permissions, and a database user.
Connection details for only one instance in the cluster need be supplied to configure the agent. The agent will discover the remaining instances and configure all connections automatically. The instance host and port can be retrieved from the AWS Console. Navigate to DocumentDB, then Clusters. Select the cluster identifier and navigate to Connectivity & Security. Copy the host and port from one of the “Connect to this cluster with…” fields.
To create an IAM user with the correct permissions, perform the following steps.
{
"Sid": "DocDBClusterReadAccess",
"Effect": "Allow",
"Action": [
"rds:DescribeDBClusters",
"rds:DescribeDBInstances",
"rds:DescribeGlobalClusters",
"cloudwatch:ListMetrics",
"cloudwatch:GetMetricStatistics"
],
"Resource": [
"arn:aws:rds:*:<account>:*:*"
]
}
{
"Sid": "DocDBElasticReadAccess",
"Effect": "Allow",
"Action": [
"docdb-elastic:ListClusters",
"docdb-elastic:GetCluster"
],
"arn:aws:rds:*:<account>:*:*"
}
To create an access key to collect monitoring data from AWS services, perform the following steps.
The DocumentDB agent requires database user credentials with certain minimum privileges in order to be able to fully monitor the server and cluster. All user authorizations must be for the admin database.
For core monitoring functionality, a user on the admin database with clusterMonitor and readAnyDatabase roles is required. Such a user can be created with the following mongosh code. Be sure to replace your desired username and password before executing:
db.getSiblingDB('admin').createUser({
user: 'foglightAgent',
pwd: '<xxxx>',
roles: ['clusterMonitor', 'readAnyDatabase']
})
An additional custom privilege is required for monitoring users and roles. The following mongosh code can be used to create such a role with this privilege and grant it to the monitoring user. Again, be sure to change the username used below if using something other than foglightUser:
db.getSiblingDB('admin').createRole({
role: 'viewAllUsersAndRoles',
privileges: [{ resource: { db: '', collection: '' }, actions: ['viewUser', 'viewRole'] }],
roles: []
})
db.getSiblingDB('admin').grantRolesToUser('foglightAgent', ['viewAllUsersAndRoles'])