Stop Monitoring a Process
- OAuth 2.0 authentication for programmatic access to Cloud Manager is available as a Preview feature.
- The feature and the corresponding documentation might change at any time during the Preview period. To use OAuth 2.0 authentication, create a service account to use in your requests to the Cloud Manager Public API.
This tutorial shows you how to stop monitoring a process. Once you stop monitoring a process, Cloud Manager stops displaying its status and tracking its metrics.
Understand the Objectives
Learn how to use the Cloud Manager Administration API to:
Find the host ID for the process.
Stop monitoring the process that matches the host ID.
Verify that Cloud Manager no longer monitors the process.
Complete the Prerequisites
Complete these prerequisites before you complete the tutorial.
Configure your access to the Cloud Manager Administration API.
Get the permissions needed to change monitoring settings. You need one of the following roles:
Terminate the backups for the process before you stop monitoring it.
Follow These Steps
Complete all the following steps to use the API to stop monitoring a process.
Find the host ID for the process.
Use the Get One Host by Hostname and Port
resource to find the process and retrieve the id
value.
Learn What This Step Does
The Get One Host by Hostname and Port
resource uses the hostname and port you specify to find the process. Then, it
returns information about this process. You can find the id
needed for the
next step in the response.
Issue This Command
Copy the following curl command. Paste it into your preferred terminal or console. Replace the displayed placeholders with these values:
Placeholder | Description |
---|---|
{PUBLIC-KEY} | Public part of your API key. |
{PRIVATE-KEY} | Private part of your API key. |
{PROJECT-ID} | Unique identifier of the project that owns the host. |
{HOSTNAME} | Primary hostname that Cloud Manager uses to connect to the instance.
This may be a hostname, an FQDN, an IPv4 address, or an IPv6
address. |
{PORT} | Port on which the process listens. |
Replace the placeholders in the command, then execute it.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --request GET "https://mongodb.prakticum-team.ru/proxy/cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/hosts/byName/{HOSTNAME}:{PORT}"
Copy the Host's ID
In the response body, copy the value returned in the id
field. You need the
value for the next step.
Example
1 { 2 "alertsEnabled" : true, 3 "aliases": [ "server1.example.com:27017", "203.0.113.3:27017" ], 4 "authMechanismName" : "SCRAM-SHA-1", 5 "clusterId" : "<cluster-ID-1>", 6 "created" : "2021-04-22T19:56:50Z", 7 "groupId" : "<project-ID-1>", 8 "hasStartupWarnings" : false, 9 "hidden" : false, 10 "hostEnabled" : true, 11 "hostname" : "server1.example.com", 12 "id" : "{HOST-ID}", 13 "ipAddress": "203.0.113.3", 14 }
Stop monitoring the process that matches the host ID.
Use the Stop Monitoring One Host resource to stop monitoring the host.
Learn What This Step Does
The Stop Monitoring One Host resource doesn't actually delete the host. The resource deletes the host from the list of hosts that Cloud Manager monitors. This removes the process from monitoring.
Issue This Command
Copy the following curl command. Paste it into your preferred terminal or console. Replace the displayed placeholders with these values:
Placeholder | Description |
---|---|
{PUBLIC-KEY} | Public part of your API key. |
{PRIVATE-KEY} | Private part of your API key. |
{PROJECT-ID} | Unique identifier of the project that owns the host. |
{HOST-ID} | Unique identifier of the host for the process. Use the id from
step 1. |
Replace the placeholders in the command, then execute it.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --request DELETE "https://mongodb.prakticum-team.ru/proxy/cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/hosts/{HOST-ID}"
Verify that Cloud Manager no longer monitors the process.
Use the Get One Host by Hostname and Port
resource again to attempt to find the process using its hostname and port. Then, verify
that details
returns No host with hostname
and port {HOSTNAME}:{PORT} exists in group {PROJECT-ID}
.
Learn What This Step Does
The Get One Host by Hostname and Port
resource uses the hostname and port you specify to find the process. Then, it
returns information about this process. You can tell that Cloud Manager doesn't monitor
the process if the details
value in the response is No host with hostname
and port {HOSTNAME}:{PORT} exists in group {PROJECT-ID}
.
This means that Cloud Manager can't find the host in the
list of processes that it monitors.
Issue This Command
Copy the following curl command. Paste it into your preferred terminal or console. Replace the displayed placeholders with these values:
Placeholder | Description |
---|---|
{PUBLIC-KEY} | Public part of your API key. |
{PRIVATE-KEY} | Private part of your API key. |
{PROJECT-ID} | Unique identifier of the project that owns the host. |
{HOSTNAME} | Primary hostname that Cloud Manager uses to connect to this
instance. This may be a hostname, an FQDN, an IPv4 address, or an IPv6
address. |
{PORT} | Port on which the process listens. |
Replace the placeholders in the command, then execute it.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --request GET "https://mongodb.prakticum-team.ru/proxy/cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/hosts/byName/{HOSTNAME}:{PORT}"
Check the Response Details
In the response body, check the value returned in the details
field. If
details
returns No host with hostname
and port {HOSTNAME}:{PORT} exists in group {PROJECT-ID}
, you succeeded. Cloud Manager no longer monitors the process.