Docs Menu

Docs HomeMongoDB Ops Manager

Stop Monitoring a Process

On this page

  • Understand the Objectives
  • Complete the Prerequisites
  • Follow These Steps

This tutorial shows you how to stop monitoring a process. Once you stop monitoring a process, Ops Manager stops displaying its status and tracking its metrics.

Learn how to use the Ops Manager Administration API to:

  • Find the host ID for the process.

  • Stop monitoring the process that matches the host ID.

  • Verify that Ops Manager no longer monitors the process.

Complete these prerequisites before you complete the tutorial.

Complete all the following steps to use the API to stop monitoring a process.

1

Use the Get One Host by Hostname and Port resource to find the process and retrieve the id value.

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.

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 Ops 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://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}/hosts/byName/{HOSTNAME}:{PORT}"

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}
2

Use the Stop Monitoring One Host resource to stop monitoring the host.

The Stop Monitoring One Host resource doesn't actually delete the host. The resource deletes the host from the list of hosts that Ops Manager monitors. This removes the process from monitoring.

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://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}/hosts/{HOST-ID}"
3

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}.

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 Ops 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 Ops Manager can't find the host in the list of processes that it monitors.

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 Ops 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://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}/hosts/byName/{HOSTNAME}:{PORT}"

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. Ops Manager no longer monitors the process.

←  Upload the Latest Version Manifest to Ops Manager with the APITroubleshooting →